source: geisa/persistence/implementation/hibernate.cfg.xml @ 674

Last change on this file since 674 was 674, checked in by npipsl, 12 years ago

Connexion a MySQL avec C3P0

File size: 4.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
3
4<beans>
5        <!-- sessionFactory -->
6        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
7                <property name="configLocation">
8                        <value>classpath:hibernate-domain.cfg.xml</value>
9                </property>
10
11                <property name="configurationClass">
12                        <value>org.hibernate.cfg.AnnotationConfiguration</value>
13                </property>
14
15                <property name="hibernateProperties">
16                        <props>
17                <!--<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>-->
18                <!--<prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop>-->
19                <!--<prop key="hibernate.connection.url">jdbc:postgresql://darkstar.ipslnet:5432/PROJECT_SOURCE</prop>-->
20                <!--<prop key="hibernate.connection.username">postgres</prop>-->
21                <!--<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>-->
22                <!--<prop key="hibernate.generate_statistics">true</prop>-->
23                <!--<prop key="hibernate.connection.url">jdbc:mysql://localhost/geisa?autoReconnect=true</prop>-->
24
25
26                <!--<prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
27                <prop key="hibernate.connection.url">jdbc:mysql://localhost/geisa</prop> -->
28                <!-- en local-->
29               <!--  <prop key="hibernate.connection.username">root</prop>-->
30                <!-- sur naboo -->
31                <!--<prop key="hibernate.connection.username">geisa</prop>-->
32               <!-- <prop key="hibernate.connection.password">geisa11</prop>
33                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
34                <prop key="hibernate.show_sql">true</prop> -->
35
36
37                <!-- configuration pool via c3p0-->
38               <prop key="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>
39                <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
40                <prop key="hibernate.connection.url">jdbc:mysql://localhost/geisa</prop>
41
42                <!-- en local-->
43                <prop key="hibernate.connection.username">root</prop>
44                <!-- sur naboo -->
45                <!--<prop key="hibernate.connection.username">geisa</prop>-->
46                <prop key="hibernate.connection.password">geisa11</prop>
47                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
48                <prop key="hibernate.show_sql">true</prop>
49                <prop key="hibernate.c3p0.acquire_increment">1</prop><!-- Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted-->
50                <prop key="hibernate.c3p0.idle_test_period">100</prop>  <!--seconds =idle time in seconds before a connection is automatically validated-->
51                <prop key="hibernate.c3p0.max_size">100</prop> <!--Taille maximale du pool-->
52                <prop key="hibernate.c3p0.min_size">10</prop> <!--Taille minimale du pool -->
53                <prop key="hibernate.c3p0.timeout">0</prop><!-- seconds / 0 never expire-->
54                <prop key="hibernate.c3p0.max_statements">0</prop><!--  Taille du cache de statements de C3P0. 0 = désactive le cache -->
55
56
57            </props>
58        </property>
59
60        </bean>
61
62
63        <bean id="transactionManager"
64                class="org.springframework.orm.hibernate3.HibernateTransactionManager">
65                <property name="sessionFactory" ref="sessionFactory" />
66        </bean>
67
68        <bean id="transactionProxy" abstract="true"
69                class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
70                <property name="transactionManager">
71                        <ref bean="transactionManager" />
72                </property>
73                <property name="transactionAttributes">
74                        <props>
75                                <prop key="insert*">PROPAGATION_REQUIRED</prop>
76                                <prop key="update*">PROPAGATION_REQUIRED</prop>
77                                <prop key="save*">PROPAGATION_REQUIRED</prop>
78                                <prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
79                        </props>
80                </property>
81        </bean>
82
83        <!-- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> -->
84        <!-- <property name="sessionFactory" ref="sessionFactory" /> -->
85        <!-- </bean> -->
86
87
88</beans>
Note: See TracBrowser for help on using the repository browser.