26
26
import java .util .Enumeration ;
27
27
import java .util .Map ;
28
28
import java .util .Properties ;
29
+
29
30
import javax .sql .DataSource ;
30
31
import javax .transaction .TransactionManager ;
31
32
32
33
import org .hibernate .HibernateException ;
33
34
import org .hibernate .Interceptor ;
34
35
import org .hibernate .Session ;
35
36
import org .hibernate .SessionFactory ;
36
- import org .hibernate .cache .CacheProvider ;
37
37
import org .hibernate .cfg .Configuration ;
38
38
import org .hibernate .cfg .Environment ;
39
39
import org .hibernate .cfg .NamingStrategy ;
43
43
import org .hibernate .event .EventListeners ;
44
44
import org .hibernate .tool .hbm2ddl .DatabaseMetadata ;
45
45
import org .hibernate .transaction .JTATransactionFactory ;
46
-
47
46
import org .springframework .beans .BeanUtils ;
48
47
import org .springframework .beans .factory .BeanClassLoaderAware ;
49
48
import org .springframework .core .io .ClassPathResource ;
@@ -115,8 +114,9 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
115
114
private static final ThreadLocal <Object > configTimeRegionFactoryHolder =
116
115
new ThreadLocal <Object >();
117
116
118
- private static final ThreadLocal <CacheProvider > configTimeCacheProviderHolder =
119
- new ThreadLocal <CacheProvider >();
117
+ @ SuppressWarnings ("deprecation" )
118
+ private static final ThreadLocal <org .hibernate .cache .CacheProvider > configTimeCacheProviderHolder =
119
+ new ThreadLocal <org .hibernate .cache .CacheProvider >();
120
120
121
121
private static final ThreadLocal <LobHandler > configTimeLobHandlerHolder =
122
122
new ThreadLocal <LobHandler >();
@@ -167,7 +167,8 @@ static Object getConfigTimeRegionFactory() {
167
167
* during configuration.
168
168
* @see #setCacheProvider
169
169
*/
170
- public static CacheProvider getConfigTimeCacheProvider () {
170
+ @ SuppressWarnings ("deprecation" )
171
+ public static org .hibernate .cache .CacheProvider getConfigTimeCacheProvider () {
171
172
return configTimeCacheProviderHolder .get ();
172
173
}
173
174
@@ -207,7 +208,8 @@ public static LobHandler getConfigTimeLobHandler() {
207
208
208
209
private Object cacheRegionFactory ;
209
210
210
- private CacheProvider cacheProvider ;
211
+ @ SuppressWarnings ("deprecation" )
212
+ private org .hibernate .cache .CacheProvider cacheProvider ;
211
213
212
214
private LobHandler lobHandler ;
213
215
@@ -401,7 +403,7 @@ public void setCacheRegionFactory(Object cacheRegionFactory) {
401
403
* @see #setCacheRegionFactory
402
404
*/
403
405
@ Deprecated
404
- public void setCacheProvider (CacheProvider cacheProvider ) {
406
+ public void setCacheProvider (org . hibernate . cache . CacheProvider cacheProvider ) {
405
407
this .cacheProvider = cacheProvider ;
406
408
}
407
409
@@ -650,7 +652,7 @@ protected SessionFactory buildSessionFactory() throws Exception {
650
652
}
651
653
652
654
if (dataSource != null ) {
653
- Class providerClass = LocalDataSourceConnectionProvider .class ;
655
+ Class <?> providerClass = LocalDataSourceConnectionProvider .class ;
654
656
if (isUseTransactionAwareDataSource () || dataSource instanceof TransactionAwareDataSourceProxy ) {
655
657
providerClass = TransactionAwareDataSourceConnectionProvider .class ;
656
658
}
@@ -719,7 +721,7 @@ else if (this.cacheProvider != null) {
719
721
720
722
if (this .entityCacheStrategies != null ) {
721
723
// Register cache strategies for mapped entities.
722
- for (Enumeration classNames = this .entityCacheStrategies .propertyNames (); classNames .hasMoreElements ();) {
724
+ for (Enumeration <?> classNames = this .entityCacheStrategies .propertyNames (); classNames .hasMoreElements ();) {
723
725
String className = (String ) classNames .nextElement ();
724
726
String [] strategyAndRegion =
725
727
StringUtils .commaDelimitedListToStringArray (this .entityCacheStrategies .getProperty (className ));
@@ -739,7 +741,7 @@ else if (strategyAndRegion.length > 0) {
739
741
740
742
if (this .collectionCacheStrategies != null ) {
741
743
// Register cache strategies for mapped collections.
742
- for (Enumeration collRoles = this .collectionCacheStrategies .propertyNames (); collRoles .hasMoreElements ();) {
744
+ for (Enumeration <?> collRoles = this .collectionCacheStrategies .propertyNames (); collRoles .hasMoreElements ();) {
743
745
String collRole = (String ) collRoles .nextElement ();
744
746
String [] strategyAndRegion =
745
747
StringUtils .commaDelimitedListToStringArray (this .collectionCacheStrategies .getProperty (collRole ));
@@ -938,6 +940,7 @@ public void updateDatabaseSchema() throws DataAccessException {
938
940
hibernateTemplate .execute (
939
941
new HibernateCallback <Object >() {
940
942
public Object doInHibernate (Session session ) throws HibernateException , SQLException {
943
+ @ SuppressWarnings ("deprecation" )
941
944
Connection con = session .connection ();
942
945
DatabaseMetadata metadata = new DatabaseMetadata (con , dialect );
943
946
String [] sql = getConfiguration ().generateSchemaUpdateScript (dialect , metadata );
@@ -982,6 +985,7 @@ public void validateDatabaseSchema() throws DataAccessException {
982
985
hibernateTemplate .execute (
983
986
new HibernateCallback <Object >() {
984
987
public Object doInHibernate (Session session ) throws HibernateException , SQLException {
988
+ @ SuppressWarnings ("deprecation" )
985
989
Connection con = session .connection ();
986
990
DatabaseMetadata metadata = new DatabaseMetadata (con , dialect , false );
987
991
getConfiguration ().validateSchema (dialect , metadata );
@@ -1018,6 +1022,7 @@ public void dropDatabaseSchema() throws DataAccessException {
1018
1022
hibernateTemplate .execute (
1019
1023
new HibernateCallback <Object >() {
1020
1024
public Object doInHibernate (Session session ) throws HibernateException , SQLException {
1025
+ @ SuppressWarnings ("deprecation" )
1021
1026
Connection con = session .connection ();
1022
1027
String [] sql = getConfiguration ().generateDropSchemaScript (dialect );
1023
1028
executeSchemaScript (con , sql );
@@ -1054,6 +1059,7 @@ public void createDatabaseSchema() throws DataAccessException {
1054
1059
hibernateTemplate .execute (
1055
1060
new HibernateCallback <Object >() {
1056
1061
public Object doInHibernate (Session session ) throws HibernateException , SQLException {
1062
+ @ SuppressWarnings ("deprecation" )
1057
1063
Connection con = session .connection ();
1058
1064
String [] sql = getConfiguration ().generateSchemaCreationScript (dialect );
1059
1065
executeSchemaScript (con , sql );
0 commit comments