Project

General

Profile

Download (4.17 KB) Statistics
| Branch: | Tag: | Revision:
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xmlns:context="http://www.springframework.org/schema/context"
5
	xsi:schemaLocation="http://www.springframework.org/schema/beans
6
    http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
7
    http://www.springframework.org/schema/context
8
    http://www.springframework.org/schema/context/spring-context-4.3.xsd">
9
    
10
    
11
    <bean id="dataSource"  lazy-init="true" class="eu.etaxonomy.cdm.database.SelectableDataSource">
12
    	<!--  The property beanDefinitionFile defaults to "datasources.xml" in {USER_HOME}./cdmLibrary 
13
    	
14
    	WARNING !!!
15
    	The beanDefinitionFile now mus be configured in 
16
    	eu.etaxonomy.cdm.database.DataSourceBeanLoader
17
    	
18
    	-->
19
    </bean>
20
    
21
    <!-- This configures default properties, which can overridden with the file specified by the location property -->
22
    <bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
23
        <property name="properties">
24
            <props>
25
             <!-- 
26
                  Configuring the C3P0ConnectionProvider
27
                  ========================================
28
                  see http://www.mchange.com/projects/c3p0/index.html#hibernate-specific
29
                  and also org.springframework.orm.hibernate3.AbstractSessionFactoryBean.setDataSource(DataSource dataSource)
30
                  
31
                  IMPORTANT: 
32
                  Because of the constraint (1) the org.hibernate.connection.C3P0ConnectionProvider anc not be used 
33
                  for the cdm library because it requires the dataSource bean in some cases. 
34
                  
35
				          (1)
36
				          Do NOT specify the dataSource in the sessionFactory for example in the 
37
				          org.springframework.orm.hibernate5.LocalSessionFactoryBean
38
				          !!!==> If *dataSource* is set, this will override corresponding settings in Hibernate properties.!!!
39
 						  If this is set, the Hibernate settings should not define a connection provider to 
40
 					      avoid meaningless double configuration.
41
				          (2)
42
				          Hibernate uses the hibernate.c3p0.max_size property to determine if c3p0
43
                          is begin used.  Therefore the max_size property MUST be set. - maybe not need in hibernate 3.4 +
44
                          (3) If you are using Hibernate's C3P0ConnectionProvider you must set the following properties 
45
                          in your hibernate configuration, using hibernate-specific configuration keys. 
46
                          All other properties must be defined as usual in a c3p0.properties file. 
47
                          This is confusing, and will hopefully be simplified some time in the future, but for now... 
48
                          
49
                          DOUMENTATION UPDATE (2015-05-22):
50
                          Hibernate's C3P0ConnectionProvider renames 7 c3p0 configuration properties, which, 
51
                          if set in your hibernate configuration, will override any configuration you may have set 
52
                          in a c3p0.properties file.
53
                          TODO: are points (2) and (3) still valid? I don't think so! (AK)
54
                          
55
                          
56
                          	hibernate.c3p0.acquire_increment
57
							hibernate.c3p0.idle_test_period
58
							hibernate.c3p0.timeout
59
							hibernate.c3p0.max_size
60
							hibernate.c3p0.max_statements
61
							hibernate.c3p0.min_size
62
							hibernate.c3p0.validate 
63
				      -->
64
              <prop key="hibernate.hbm2ddl.auto">update</prop>
65
              <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
66
              <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.internal.NoCachingRegionFactory</prop>
67
              <prop key="hibernate.show_sql">false</prop>
68
              <prop key="hibernate.format_sql">false</prop>
69
              <prop key="hibernate.search.default.indexBase">${user.home}/.cdmLibrary/</prop>
70
            </props>
71
        </property>
72
    </bean>
73

    
74
</beans>
(4-4/4)