Polishing
This commit is contained in:
@@ -43,10 +43,14 @@ 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.
|
||||
* 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.
|
||||
* <p><b>This variant of LocalSessionFactoryBean requires Hibernate 4.0 or higher.</b>
|
||||
* Note that this version is not compatible with the (the quite refactored) Hibernate
|
||||
* 4.3 yet; please upgrade to the Spring 4.0 line for full Hibernate 4.3 support.
|
||||
* We recommend using this version with the latest Hibernate 4.1.x or 4.2.x releases.
|
||||
*
|
||||
* <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.
|
||||
@@ -54,6 +54,11 @@ 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><b>Requires Hibernate 4.0 or higher.</b> Note that this version is not
|
||||
* compatible with the (the quite refactored) Hibernate 4.3 yet; please upgrade
|
||||
* to the Spring 4.0 line for full Hibernate 4.3 support. We recommend using
|
||||
* this version with the latest Hibernate 4.1.x or 4.2.x releases.
|
||||
*
|
||||
* <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
|
||||
* "hibernate.transaction.factory_class" property to {@link CMTTransactionFactory}.
|
||||
|
||||
@@ -1001,7 +1001,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
final String queryName, final String[] paramNames, final Object[] values)
|
||||
throws DataAccessException {
|
||||
|
||||
if (paramNames != null && values != null && paramNames.length != values.length) {
|
||||
if (values != null && (paramNames == null || paramNames.length != values.length)) {
|
||||
throw new IllegalArgumentException("Length of paramNames array must match length of values array");
|
||||
}
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
|
||||
@@ -165,7 +165,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
protected void postProcessMappings(Configuration config) throws HibernateException {
|
||||
AnnotationConfiguration annConfig = (AnnotationConfiguration) config;
|
||||
if (this.annotatedClasses != null) {
|
||||
for (Class annotatedClass : this.annotatedClasses) {
|
||||
for (Class<?> annotatedClass : this.annotatedClasses) {
|
||||
annConfig.addAnnotatedClass(annotatedClass);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user