Upgrade to Hibernate ORM 5.0 RC1 and Hibernate Validator 5.2 RC1

Includes other recent dependency updates (JRuby 1.7.20, Jetty 9.2.11, Tomcat 8.0.23, Reactor 2.0.3)

Issue: SPR-13088
This commit is contained in:
Juergen Hoeller 2015-06-01 18:35:57 +02:00
parent 89c1674b89
commit 11401bd5e4
4 changed files with 26 additions and 16 deletions

View File

@ -37,31 +37,31 @@ configure(allprojects) { project ->
ext.gsonVersion = "2.3.1" ext.gsonVersion = "2.3.1"
ext.hibernate3Version = "3.6.10.Final" ext.hibernate3Version = "3.6.10.Final"
ext.hibernate4Version = "4.3.10.Final" ext.hibernate4Version = "4.3.10.Final"
ext.hibernate5Version = "5.0.0.Beta2" // to be upgraded to 5.0 final in time for Spring Framework 4.2 GA ext.hibernate5Version = "5.0.0.CR1" // to be upgraded to 5.0 final in time for Spring Framework 4.2 GA
ext.hibval4Version = "4.3.2.Final" ext.hibval4Version = "4.3.2.Final"
ext.hibval5Version = "5.2.0.Beta1" // to be upgraded to 5.2 final in time for Spring Framework 4.2 GA ext.hibval5Version = "5.2.0.CR1" // to be upgraded to 5.2 final in time for Spring Framework 4.2 GA
ext.hsqldbVersion = "2.3.2" ext.hsqldbVersion = "2.3.2"
ext.httpclientVersion = "4.4" ext.httpclientVersion = "4.4"
ext.httpasyncVersion = "4.0.2" ext.httpasyncVersion = "4.0.2"
ext.jackson2Version = "2.6.0-rc1" // to be upgraded to 2.6 final in time for Spring Framework 4.2 GA ext.jackson2Version = "2.6.0-rc1" // to be upgraded to 2.6 final in time for Spring Framework 4.2 GA
ext.jasperreportsVersion = "6.1.0" ext.jasperreportsVersion = "6.1.0"
ext.javamailVersion = "1.5.3" ext.javamailVersion = "1.5.3"
ext.jettyVersion = "9.2.10.v20150310" ext.jettyVersion = "9.2.11.v20150529"
ext.jodaVersion = "2.7" ext.jodaVersion = "2.7"
ext.jrubyVersion = "1.7.19" ext.jrubyVersion = "1.7.20"
ext.jtaVersion = "1.2" ext.jtaVersion = "1.2"
ext.junitVersion = "4.12" ext.junitVersion = "4.12"
ext.nettyVersion = "4.0.28.Final" ext.nettyVersion = "4.0.28.Final"
ext.openjpaVersion = "2.4.0" ext.openjpaVersion = "2.4.0"
ext.protobufVersion = "2.6.1" ext.protobufVersion = "2.6.1"
ext.reactorVersion = "2.0.2.RELEASE" ext.reactorVersion = "2.0.3.RELEASE"
ext.slf4jVersion = "1.7.12" ext.slf4jVersion = "1.7.12"
ext.snakeyamlVersion = "1.15" ext.snakeyamlVersion = "1.15"
ext.snifferVersion = "1.14" ext.snifferVersion = "1.14"
ext.testngVersion = "6.9.4" ext.testngVersion = "6.9.4"
ext.tiles2Version = "2.2.2" ext.tiles2Version = "2.2.2"
ext.tiles3Version = "3.0.5" ext.tiles3Version = "3.0.5"
ext.tomcatVersion = "8.0.22" ext.tomcatVersion = "8.0.23"
ext.tyrusVersion = "1.3.5" // constrained by WebLogic 12.1.3 support ext.tyrusVersion = "1.3.5" // constrained by WebLogic 12.1.3 support
ext.undertowVersion = "1.2.6.Final" ext.undertowVersion = "1.2.6.Final"
ext.woodstoxVersion = "4.4.1" ext.woodstoxVersion = "4.4.1"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -95,6 +95,7 @@ public abstract class JRubyScriptUtils {
/** /**
* Initializes an instance of the {@link org.jruby.Ruby} runtime. * Initializes an instance of the {@link org.jruby.Ruby} runtime.
*/ */
@SuppressWarnings("unchecked")
private static Ruby initializeRuntime() { private static Ruby initializeRuntime() {
return JavaEmbedUtils.initialize(Collections.EMPTY_LIST); return JavaEmbedUtils.initialize(Collections.EMPTY_LIST);
} }

View File

@ -420,10 +420,10 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public T doInHibernate(Session session) throws HibernateException { public T doInHibernate(Session session) throws HibernateException {
if (lockMode != null) { if (lockMode != null) {
return (T) session.get(entityClass, id, new LockOptions(lockMode)); return session.get(entityClass, id, new LockOptions(lockMode));
} }
else { else {
return (T) session.get(entityClass, id); return session.get(entityClass, id);
} }
} }
}); });
@ -465,10 +465,10 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public T doInHibernate(Session session) throws HibernateException { public T doInHibernate(Session session) throws HibernateException {
if (lockMode != null) { if (lockMode != null) {
return (T) session.load(entityClass, id, new LockOptions(lockMode)); return session.load(entityClass, id, new LockOptions(lockMode));
} }
else { else {
return (T) session.load(entityClass, id); return session.load(entityClass, id);
} }
} }
}); });

View File

@ -39,13 +39,14 @@ import org.hibernate.UnresolvableObjectException;
import org.hibernate.WrongClassException; import org.hibernate.WrongClassException;
import org.hibernate.dialect.lock.OptimisticEntityLockException; import org.hibernate.dialect.lock.OptimisticEntityLockException;
import org.hibernate.dialect.lock.PessimisticEntityLockException; import org.hibernate.dialect.lock.PessimisticEntityLockException;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.DataException; import org.hibernate.exception.DataException;
import org.hibernate.exception.JDBCConnectionException; import org.hibernate.exception.JDBCConnectionException;
import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.LockAcquisitionException;
import org.hibernate.exception.SQLGrammarException; import org.hibernate.exception.SQLGrammarException;
import org.hibernate.service.spi.Wrapped; import org.hibernate.service.UnknownServiceException;
import org.springframework.dao.CannotAcquireLockException; import org.springframework.dao.CannotAcquireLockException;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@ -88,16 +89,24 @@ public abstract class SessionFactoryUtils {
* Determine the DataSource of the given SessionFactory. * Determine the DataSource of the given SessionFactory.
* @param sessionFactory the SessionFactory to check * @param sessionFactory the SessionFactory to check
* @return the DataSource, or {@code null} if none found * @return the DataSource, or {@code null} if none found
* @see SessionFactoryImplementor#getConnectionProvider * @see ConnectionProvider
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static DataSource getDataSource(SessionFactory sessionFactory) { public static DataSource getDataSource(SessionFactory sessionFactory) {
if (sessionFactory instanceof SessionFactoryImplementor) { if (sessionFactory instanceof SessionFactoryImplementor) {
Wrapped cp = ((SessionFactoryImplementor) sessionFactory).getConnectionProvider(); try {
ConnectionProvider cp = ((SessionFactoryImplementor) sessionFactory).getServiceRegistry().getService(
ConnectionProvider.class);
if (cp != null) { if (cp != null) {
return cp.unwrap(DataSource.class); return cp.unwrap(DataSource.class);
} }
} }
catch (UnknownServiceException ex) {
if (logger.isDebugEnabled()) {
logger.debug("No ConnectionProvider found - cannot determine DataSource for SessionFactory: " + ex);
}
}
}
return null; return null;
} }