Merge branch 'master' of wp5.e-taxonomy.eu:/var/git/cdmlib into remoting-4.0
[cdmlib.git] / cdmlib-remote-webapp / src / main / webapp / WEB-INF / datasources / routing-datasource.xml
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-2.5.xsd
7 http://www.springframework.org/schema/context
8 http://www.springframework.org/schema/context/spring-context-2.5.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 <!-- The property defaultDatasourceName defaults to "default"
20 <property name="beanDefinitionFile" value="datasources-p6spy.xml" />
21 <property name="defaultDatasourceName" value="cichorieae" />
22 -->
23 </bean>
24
25 <!-- This configures default properties, which can overridden with the file specified by the location property -->
26 <bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
27 <property name="properties">
28 <props>
29 <!--
30 Configuring the C3P0ConnectionProvider
31 ========================================
32 see http://www.mchange.com/projects/c3p0/index.html#hibernate-specific
33 and also org.springframework.orm.hibernate3.AbstractSessionFactoryBean.setDataSource(DataSource dataSource)
34
35 IMPORTANT:
36 Because of the constraint (1) the org.hibernate.connection.C3P0ConnectionProvider anc not be used
37 for the cdm library because it requires the dataSource bean in some cases.
38
39 (1)
40 Do NOT specify the dataSource in the sessionFactory for example in the
41 org.springframework.orm.hibernate4.LocalSessionFactoryBean
42 !!!==> If *dataSource* is set, this will override corresponding settings in Hibernate properties.!!!
43 If this is set, the Hibernate settings should not define a connection provider to
44 avoid meaningless double configuration.
45 (2)
46 Hibernate uses the hibernate.c3p0.max_size property to determine if c3p0
47 is begin used. Therefore the max_size property MUST be set. - maybe not need in hibernate 3.4 +
48 (3) If you are using Hibernate's C3P0ConnectionProvider you must set the following properties
49 in your hibernate configuration, using hibernate-specific configuration keys.
50 All other properties must be defined as usual in a c3p0.properties file.
51 This is confusing, and will hopefully be simplified some time in the future, but for now...
52
53 DOUMENTATION UPDATE (2015-05-22):
54 Hibernate's C3P0ConnectionProvider renames 7 c3p0 configuration properties, which,
55 if set in your hibernate configuration, will override any configuration you may have set
56 in a c3p0.properties file.
57 TODO: are points (2) and (3) still valid? I don't think so! (AK)
58
59
60 hibernate.c3p0.acquire_increment
61 hibernate.c3p0.idle_test_period
62 hibernate.c3p0.timeout
63 hibernate.c3p0.max_size
64 hibernate.c3p0.max_statements
65 hibernate.c3p0.min_size
66 hibernate.c3p0.validate
67 -->
68 <prop key="hibernate.hbm2ddl.auto">update</prop>
69 <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
70 <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.internal.NoCachingRegionFactory</prop>
71 <prop key="hibernate.show_sql">false</prop>
72 <prop key="hibernate.format_sql">false</prop>
73 <prop key="hibernate.search.default.indexBase">${user.home}/.cdmLibrary/</prop>
74 </props>
75 </property>
76 </bean>
77
78 </beans>