34
34
import org .hibernate .Session ;
35
35
import org .hibernate .SessionFactory ;
36
36
import org .hibernate .cache .CacheProvider ;
37
- import org .hibernate .cache .RegionFactory ;
38
37
import org .hibernate .cfg .Configuration ;
39
38
import org .hibernate .cfg .Environment ;
40
39
import org .hibernate .cfg .NamingStrategy ;
90
89
* {@link org.springframework.orm.hibernate3.support.OpenSessionInViewFilter} /
91
90
* {@link org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor}.
92
91
*
93
- * <p><b>Requires Hibernate 3.3 or later.</b> Note that this factory will use
94
- * "on_close" as default Hibernate connection release mode, unless in the
95
- * case of a "jtaTransactionManager" specified, for the reason that
96
- * this is appropriate for most Spring-based applications (in particular when
97
- * using Spring's HibernateTransactionManager). Hibernate 3.0 used "on_close"
98
- * as its own default too; however, Hibernate 3.1 changed this to "auto"
99
- * (i.e. "after_statement" or "after_transaction").
92
+ * <p><b>Requires Hibernate 3.2 or later, with Hibernate 3.3 being recommended.</b>
93
+ * Note that this factory will use "on_close" as default Hibernate connection
94
+ * release mode, unless in the case of a "jtaTransactionManager" specified,
95
+ * for the reason that this is appropriate for most Spring-based applications
96
+ * (in particular when using Spring's HibernateTransactionManager).
100
97
*
101
98
* @author Juergen Hoeller
102
99
* @since 1.2
@@ -115,8 +112,8 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
115
112
private static final ThreadLocal <TransactionManager > configTimeTransactionManagerHolder =
116
113
new ThreadLocal <TransactionManager >();
117
114
118
- private static final ThreadLocal <RegionFactory > configTimeRegionFactoryHolder =
119
- new ThreadLocal <RegionFactory >();
115
+ private static final ThreadLocal <Object > configTimeRegionFactoryHolder =
116
+ new ThreadLocal <Object >();
120
117
121
118
private static final ThreadLocal <CacheProvider > configTimeCacheProviderHolder =
122
119
new ThreadLocal <CacheProvider >();
@@ -158,7 +155,7 @@ public static TransactionManager getConfigTimeTransactionManager() {
158
155
* during configuration.
159
156
* @see #setCacheRegionFactory
160
157
*/
161
- public static RegionFactory getConfigTimeRegionFactory () {
158
+ static Object getConfigTimeRegionFactory () {
162
159
return configTimeRegionFactoryHolder .get ();
163
160
}
164
161
@@ -208,7 +205,7 @@ public static LobHandler getConfigTimeLobHandler() {
208
205
209
206
private TransactionManager jtaTransactionManager ;
210
207
211
- private RegionFactory cacheRegionFactory ;
208
+ private Object cacheRegionFactory ;
212
209
213
210
private CacheProvider cacheProvider ;
214
211
@@ -384,11 +381,13 @@ public void setJtaTransactionManager(TransactionManager jtaTransactionManager) {
384
381
* Allows for using a Spring-managed RegionFactory instance.
385
382
* <p>As of Hibernate 3.3, this is the preferred mechanism for configuring
386
383
* caches, superseding the {@link #setCacheProvider CacheProvider SPI}.
384
+ * For Hibernate 3.2 compatibility purposes, the accepted reference is of type
385
+ * Object: the actual type is <code>org.hibernate.cache.RegionFactory</code>.
387
386
* <p>Note: If this is set, the Hibernate settings should not define a
388
387
* cache provider to avoid meaningless double configuration.
389
- * @see LocalRegionFactoryProxy
388
+ * @see org.hibernate.cache.RegionFactory
390
389
*/
391
- public void setCacheRegionFactory (RegionFactory cacheRegionFactory ) {
390
+ public void setCacheRegionFactory (Object cacheRegionFactory ) {
392
391
this .cacheRegionFactory = cacheRegionFactory ;
393
392
}
394
393
@@ -664,7 +663,8 @@ else if (config.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY) != null) {
664
663
665
664
if (this .cacheRegionFactory != null ) {
666
665
// Expose Spring-provided Hibernate RegionFactory.
667
- config .setProperty (Environment .CACHE_REGION_FACTORY , LocalRegionFactoryProxy .class .getName ());
666
+ config .setProperty (Environment .CACHE_REGION_FACTORY ,
667
+ "org.springframework.orm.hibernate3.LocalRegionFactoryProxy" );
668
668
}
669
669
else if (this .cacheProvider != null ) {
670
670
// Expose Spring-provided Hibernate CacheProvider.
0 commit comments