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.hibernate3.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
|
hibernate.c3p0.acquire_increment
|
54
|
hibernate.c3p0.idle_test_period
|
55
|
hibernate.c3p0.timeout
|
56
|
hibernate.c3p0.max_size
|
57
|
hibernate.c3p0.max_statements
|
58
|
hibernate.c3p0.min_size
|
59
|
hibernate.c3p0.validate
|
60
|
-->
|
61
|
<prop key="hibernate.hbm2ddl.auto">update</prop>
|
62
|
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
|
63
|
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
|
64
|
<prop key="hibernate.show_sql">false</prop>
|
65
|
<prop key="hibernate.format_sql">false</prop>
|
66
|
<prop key="hibernate.search.default.indexBase">${user.home}/.cdmLibrary/</prop>
|
67
|
</props>
|
68
|
</property>
|
69
|
</bean>
|
70
|
|
71
|
</beans>
|