/
hibernate.xml
153 lines (137 loc) · 6.98 KB
/
hibernate.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright 2006-2016 University of Dundee. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Written by: Josh Moore <josh.moore@gmx.de>
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<beans default-lazy-init="true">
<description>
Configuration for Hibernate data access. The beans in this configuration file
should NOT be generally accessed. In general, this entire file should be
considered to have a "private" scope.
</description>
<bean id="extendedMetadata" class="ome.tools.hibernate.ExtendedMetadata$Impl">
<description>
Simple cache for metadata needed throughout the server. Uses the Hibernate
metamodel to fill the cache during creation. On ContextRefreshedEvent,
the ExtendedMetadata instance will acquire the SessionFactory from the
ApplicationContext and assemble its metadata. The SessionFactory cannot
be injected directly because several security objects depend on the
metadata, but they themselves must be injected into the SessionFactory
for proper functioning. To prevent this circular dependency, we do a
form of lazy loading.
</description>
</bean>
<bean id="graphPathBean" class="ome.services.graphs.GraphPathBean" lazy-init="false">
<description>
The graph path bean reflects upon the Hibernate model object mapping
and provides information that assists in traversing it.
</description>
</bean>
<bean id="hibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean"
depends-on="serverDirectoryCheck"> <!-- ticket:5526 -->
<description>
Scope: private
</description>
<property name="properties">
<props>
<!-- JTA properties
<prop key="hibernate.connection.datasource">OmeroDs</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
<prop key="hibernate.transaction.manager_lookup_class">ome.tools.hibernate.JBossTsTransactionManagerLookup</prop>
<prop key="hibernate.current_session_context_class">ome.tools.hibernate.CurrentSessionContext</prop>
-->
<prop key="hibernate.transaction.factory_class">org.springframework.orm.hibernate3.SpringTransactionFactory</prop>
<!-- current_session_context causes transaction aware data source to be used -->
<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate3.SpringSessionContext</prop>
<!-- session context sets: auto_close_session, flush_before_completion, release_mode -->
<prop key="hibernate.dialect">${omero.db.dialect}</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.use_minimal_puts">false</prop>
<prop key="hibernate.search.default.indexBase">${omero.data.dir}</prop>
<prop key="hibernate.search.default.locking_strategy">${omero.search.locking_strategy}</prop>
<prop key="hibernate.search.analyzer">${omero.search.analyzer}</prop>
<prop key="hibernate.search.worker.batch_size">1</prop><!-- FIXME : ${omero.search.batch}-->
<!-- batch -->
<prop key="hibernate.search.default.indexwriter.batch.merge_factor">${omero.search.merge_factor}</prop>
<prop key="hibernate.search.default.indexwriter.batch.ram_buffer_size">${omero.search.ram_buffer_size}</prop>
<prop key="hibernate.search.default.indexwriter.batch.max_field_length">2147483647</prop><!-- Integer.MAX_VALUE -->
<!-- tx -->
<prop key="hibernate.search.default.indexwriter.transaction.merge_factor">${omero.search.merge_factor}</prop>
<prop key="hibernate.search.default.indexwriter.transaction.ram_buffer_size">${omero.search.ram_buffer_size}</prop>
<prop key="hibernate.search.default.indexwriter.transaction.max_field_length">2147483647</prop><!-- Integer.MAX_VALUE -->
</props>
</property>
</bean>
<!-- Scope: private -->
<!-- Used here to inject a value into the parent ome.model context
which is available to all model objects. -->
<bean class="ome.util.MapPut" lazy-init="false">
<property name="map" ref="bridges"/>
<property name="key" value="fieldBridges"/>
<property name="object" ref="fullTextIndexer"/>
</bean>
<bean id="proxyHandler" class="ome.tools.hibernate.ProxyCleanupFilter$Interceptor">
<description>
Scope: private
</description>
<constructor-arg ref="sessionHandler"/>
<constructor-arg ref="aclVoter"/>
<constructor-arg ref="currentDetails"/>
</bean>
<bean id="sessionHandler" class="ome.tools.hibernate.SessionHandler">
<description>
Scope: private
The session handler is used to handle sessions for stateful beans. A single
session is opened for any new stateful session invocation, and will be closed
once "close()" is invoked.
</description>
<constructor-arg ref="sessionFactory"/>
</bean>
<bean id="hibernateHandler" class="org.springframework.orm.hibernate3.HibernateInterceptor">
<description>
Scope: private
</description>
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="omeroSessionFactory" class="ome.tools.hibernate.SessionFactory">
<constructor-arg ref="sessionFactory"/>
<constructor-arg ref="simpleSqlAction"/><!-- Used for ome_nextval -->
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<description>
Scope: private
Note: many of the references for the sessionFactory are defined in
security.xml
</description>
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
<property name="hibernateProperties" ref="hibernateProperties"/>
<property name="entityInterceptor" ref="omeroInterceptor"/>
<property name="eventListeners" ref="eventListeners"/>
<property name="filterDefinitions">
<list>
<ref bean="OneGroupSecurityFilter"/>
<ref bean="AllGroupsSecurityFilter"/>
<ref bean="SharingSecurityFilter"/>
</list>
</property>
<property name="lobHandler" ref="lobHandler"/>
</bean>
<!-- Note: it was necessary to overwrite org.hibernate.stat.ConcurrentStatisticsImpl to prevent memory issues -->
<bean id="hibernateMBean" class="org.hibernate.jmx.StatisticsService">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="statisticsEnabled" value="${omero.db.statistics}"/>
</bean>
</beans>