Polishing
This commit is contained in:
parent
1b0ce200e0
commit
500d0da67d
|
@ -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.
|
||||
*
|
||||
* <p><b>NOTE:</b> This variant of LocalSessionFactoryBean requires Hibernate 4.0 or higher.
|
||||
* <p><b>This variant of LocalSessionFactoryBean requires Hibernate 4.0 or higher.</b>
|
||||
* 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).
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p><b>NOTE:</b> To set up Hibernate 4 for Spring-driven JTA transactions, make
|
||||
* sure to either specify the {@link #setJtaTransactionManager "jtaTransactionManager"}
|
||||
|
|
|
@ -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;
|
|||
* <p>This is designed for programmatic use, e.g. in {@code @Bean} factory methods.
|
||||
* Consider using {@link LocalSessionFactoryBean} for XML bean definition files.
|
||||
*
|
||||
* <p>Requires Hibernate 4.0 or higher. As of Spring 4.0, it is compatible with
|
||||
* (the quite refactored) Hibernate 4.3 as well.
|
||||
* <p><b>Requires Hibernate 4.0 or higher.</b> 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).
|
||||
*
|
||||
* <p><b>NOTE:</b> To set up Hibernate 4 for Spring-driven JTA transactions, make
|
||||
* sure to either use the {@link #setJtaTransactionManager} method or to set the
|
||||
|
|
|
@ -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<Object> find(String queryString) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Execute an HQL query, binding one value to a "?" parameter in the
|
||||
|
|
|
@ -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<T>() {
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@SuppressWarnings("unchecked")
|
||||
public T doInHibernate(Session session) throws HibernateException {
|
||||
if (lockMode != null) {
|
||||
return (T) session.get(entityClass, id, lockMode);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue