diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java index 267e328805..e9f7318c14 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,11 +44,15 @@ import org.springframework.core.io.support.ResourcePatternUtils; * Hibernate SessionFactory in a Spring application context; the SessionFactory can * then be passed to Hibernate-based data access objects via dependency injection. * - *

NOTE: This variant of LocalSessionFactoryBean requires Hibernate 4.0 or higher. + *

This variant of LocalSessionFactoryBean requires Hibernate 4.0 or higher. * As of Spring 4.0, it is compatible with (the quite refactored) Hibernate 4.3 as well. - * It is similar in role to the same-named class in the {@code orm.hibernate3} package. - * However, in practice, it is closer to {@code AnnotationSessionFactoryBean} since - * its core purpose is to bootstrap a {@code SessionFactory} from annotation scanning. + * We recommend using the latest Hibernate 4.2.x or 4.3.x version, depending on whether + * you need to remain JPA 2.0 compatible at runtime (Hibernate 4.2) or can upgrade to + * JPA 2.1 (Hibernate 4.3). + * + *

This class is similar in role to the same-named class in the {@code orm.hibernate3} + * package. However, in practice, it is closer to {@code AnnotationSessionFactoryBean} + * since its core purpose is to bootstrap a {@code SessionFactory} from package scanning. * *

NOTE: To set up Hibernate 4 for Spring-driven JTA transactions, make * sure to either specify the {@link #setJtaTransactionManager "jtaTransactionManager"} diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java index cd96370a5a..c2ff3ca317 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,8 +62,10 @@ import org.springframework.util.ClassUtils; *

This is designed for programmatic use, e.g. in {@code @Bean} factory methods. * Consider using {@link LocalSessionFactoryBean} for XML bean definition files. * - *

Requires Hibernate 4.0 or higher. As of Spring 4.0, it is compatible with - * (the quite refactored) Hibernate 4.3 as well. + *

Requires Hibernate 4.0 or higher. As of Spring 4.0, it is compatible with + * (the quite refactored) Hibernate 4.3 as well. We recommend using the latest + * Hibernate 4.2.x or 4.3.x version, depending on whether you need to remain JPA 2.0 + * compatible at runtime (Hibernate 4.2) or can upgrade to JPA 2.1 (Hibernate 4.3). * *

NOTE: To set up Hibernate 4 for Spring-driven JTA transactions, make * sure to either use the {@link #setJtaTransactionManager} method or to set the diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java index 38ffae9dec..aa34f618c6 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java @@ -599,7 +599,7 @@ public interface HibernateOperations { * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#createQuery */ - List find(String queryString) throws DataAccessException; + List find(String queryString) throws DataAccessException; /** * Execute an HQL query, binding one value to a "?" parameter in the diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java index c416494de0..14facbcacc 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java @@ -485,7 +485,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe * @see #prepareCriteria */ protected Session createSessionProxy(Session session) { - Class[] sessionIfcs = null; + Class[] sessionIfcs; Class mainIfc = (session instanceof org.hibernate.classic.Session ? org.hibernate.classic.Session.class : Session.class); if (session instanceof EventSource) { @@ -518,7 +518,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe return executeWithNativeSession(new HibernateCallback() { @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public T doInHibernate(Session session) throws HibernateException { if (lockMode != null) { return (T) session.get(entityClass, id, lockMode); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalSessionFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalSessionFactoryBean.java index 6218a285e0..7f9f72e2ec 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalSessionFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -246,7 +246,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * resources are specified locally via this bean. * @see org.hibernate.cfg.Configuration#configure(java.net.URL) */ - public void setConfigLocations(Resource[] configLocations) { + public void setConfigLocations(Resource... configLocations) { this.configLocations = configLocations; } @@ -260,7 +260,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * @see #setMappingLocations * @see org.hibernate.cfg.Configuration#addResource */ - public void setMappingResources(String[] mappingResources) { + public void setMappingResources(String... mappingResources) { this.mappingResources = mappingResources; } @@ -273,7 +273,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * or to specify all mappings locally. * @see org.hibernate.cfg.Configuration#addInputStream */ - public void setMappingLocations(Resource[] mappingLocations) { + public void setMappingLocations(Resource... mappingLocations) { this.mappingLocations = mappingLocations; } @@ -286,7 +286,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * or to specify all mappings locally. * @see org.hibernate.cfg.Configuration#addCacheableFile(java.io.File) */ - public void setCacheableMappingLocations(Resource[] cacheableMappingLocations) { + public void setCacheableMappingLocations(Resource... cacheableMappingLocations) { this.cacheableMappingLocations = cacheableMappingLocations; } @@ -297,7 +297,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * or to specify all mappings locally. * @see org.hibernate.cfg.Configuration#addJar(java.io.File) */ - public void setMappingJarLocations(Resource[] mappingJarLocations) { + public void setMappingJarLocations(Resource... mappingJarLocations) { this.mappingJarLocations = mappingJarLocations; } @@ -308,7 +308,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * or to specify all mappings locally. * @see org.hibernate.cfg.Configuration#addDirectory(java.io.File) */ - public void setMappingDirectoryLocations(Resource[] mappingDirectoryLocations) { + public void setMappingDirectoryLocations(Resource... mappingDirectoryLocations) { this.mappingDirectoryLocations = mappingDirectoryLocations; } @@ -408,7 +408,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * @see TypeDefinitionBean * @see org.hibernate.cfg.Mappings#addTypeDef(String, String, java.util.Properties) */ - public void setTypeDefinitions(TypeDefinitionBean[] typeDefinitions) { + public void setTypeDefinitions(TypeDefinitionBean... typeDefinitions) { this.typeDefinitions = typeDefinitions; } @@ -422,7 +422,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen * @see FilterDefinitionFactoryBean * @see org.hibernate.cfg.Configuration#addFilterDefinition */ - public void setFilterDefinitions(FilterDefinition[] filterDefinitions) { + public void setFilterDefinitions(FilterDefinition... filterDefinitions) { this.filterDefinitions = filterDefinitions; } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java index 909fe41e4e..8e90fdf19f 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,19 +99,19 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem /** * Specify annotated classes, for which mappings will be read from - * class-level JDK 1.5+ annotation metadata. + * class-level annotation metadata. * @see org.hibernate.cfg.Configuration#addAnnotatedClass(Class) */ - public void setAnnotatedClasses(Class[] annotatedClasses) { + public void setAnnotatedClasses(Class... annotatedClasses) { this.annotatedClasses = annotatedClasses; } /** * Specify the names of annotated packages, for which package-level - * JDK 1.5+ annotation metadata will be read. + * annotation metadata will be read. * @see org.hibernate.cfg.Configuration#addPackage(String) */ - public void setAnnotatedPackages(String[] annotatedPackages) { + public void setAnnotatedPackages(String... annotatedPackages) { this.annotatedPackages = annotatedPackages; } @@ -122,7 +122,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem * classes in the classpath. This is analogous to Spring's component-scan feature * ({@link org.springframework.context.annotation.ClassPathBeanDefinitionScanner}). */ - public void setPackagesToScan(String[] packagesToScan) { + public void setPackagesToScan(String... packagesToScan) { this.packagesToScan = packagesToScan; } @@ -134,7 +134,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem * Hibernate's special {@code @org.hibernate.annotations.Entity}. * @see #setPackagesToScan */ - public void setEntityTypeFilters(TypeFilter[] entityTypeFilters) { + public void setEntityTypeFilters(TypeFilter... entityTypeFilters) { this.entityTypeFilters = entityTypeFilters; }