Skip to content

Commit 11401bd

Browse files
committed
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
1 parent 89c1674 commit 11401bd

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,31 @@ configure(allprojects) { project ->
3737
ext.gsonVersion = "2.3.1"
3838
ext.hibernate3Version = "3.6.10.Final"
3939
ext.hibernate4Version = "4.3.10.Final"
40-
ext.hibernate5Version = "5.0.0.Beta2" // to be upgraded to 5.0 final in time for Spring Framework 4.2 GA
40+
ext.hibernate5Version = "5.0.0.CR1" // to be upgraded to 5.0 final in time for Spring Framework 4.2 GA
4141
ext.hibval4Version = "4.3.2.Final"
42-
ext.hibval5Version = "5.2.0.Beta1" // to be upgraded to 5.2 final in time for Spring Framework 4.2 GA
42+
ext.hibval5Version = "5.2.0.CR1" // to be upgraded to 5.2 final in time for Spring Framework 4.2 GA
4343
ext.hsqldbVersion = "2.3.2"
4444
ext.httpclientVersion = "4.4"
4545
ext.httpasyncVersion = "4.0.2"
4646
ext.jackson2Version = "2.6.0-rc1" // to be upgraded to 2.6 final in time for Spring Framework 4.2 GA
4747
ext.jasperreportsVersion = "6.1.0"
4848
ext.javamailVersion = "1.5.3"
49-
ext.jettyVersion = "9.2.10.v20150310"
49+
ext.jettyVersion = "9.2.11.v20150529"
5050
ext.jodaVersion = "2.7"
51-
ext.jrubyVersion = "1.7.19"
51+
ext.jrubyVersion = "1.7.20"
5252
ext.jtaVersion = "1.2"
5353
ext.junitVersion = "4.12"
5454
ext.nettyVersion = "4.0.28.Final"
5555
ext.openjpaVersion = "2.4.0"
5656
ext.protobufVersion = "2.6.1"
57-
ext.reactorVersion = "2.0.2.RELEASE"
57+
ext.reactorVersion = "2.0.3.RELEASE"
5858
ext.slf4jVersion = "1.7.12"
5959
ext.snakeyamlVersion = "1.15"
6060
ext.snifferVersion = "1.14"
6161
ext.testngVersion = "6.9.4"
6262
ext.tiles2Version = "2.2.2"
6363
ext.tiles3Version = "3.0.5"
64-
ext.tomcatVersion = "8.0.22"
64+
ext.tomcatVersion = "8.0.23"
6565
ext.tyrusVersion = "1.3.5" // constrained by WebLogic 12.1.3 support
6666
ext.undertowVersion = "1.2.6.Final"
6767
ext.woodstoxVersion = "4.4.1"

spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -95,6 +95,7 @@ public static Object createJRubyObject(String scriptSource, Class<?>[] interface
9595
/**
9696
* Initializes an instance of the {@link org.jruby.Ruby} runtime.
9797
*/
98+
@SuppressWarnings("unchecked")
9899
private static Ruby initializeRuntime() {
99100
return JavaEmbedUtils.initialize(Collections.EMPTY_LIST);
100101
}

spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,10 @@ public <T> T get(final Class<T> entityClass, final Serializable id, final LockMo
420420
@SuppressWarnings("unchecked")
421421
public T doInHibernate(Session session) throws HibernateException {
422422
if (lockMode != null) {
423-
return (T) session.get(entityClass, id, new LockOptions(lockMode));
423+
return session.get(entityClass, id, new LockOptions(lockMode));
424424
}
425425
else {
426-
return (T) session.get(entityClass, id);
426+
return session.get(entityClass, id);
427427
}
428428
}
429429
});
@@ -465,10 +465,10 @@ public <T> T load(final Class<T> entityClass, final Serializable id, final LockM
465465
@SuppressWarnings("unchecked")
466466
public T doInHibernate(Session session) throws HibernateException {
467467
if (lockMode != null) {
468-
return (T) session.load(entityClass, id, new LockOptions(lockMode));
468+
return session.load(entityClass, id, new LockOptions(lockMode));
469469
}
470470
else {
471-
return (T) session.load(entityClass, id);
471+
return session.load(entityClass, id);
472472
}
473473
}
474474
});

spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/SessionFactoryUtils.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@
3939
import org.hibernate.WrongClassException;
4040
import org.hibernate.dialect.lock.OptimisticEntityLockException;
4141
import org.hibernate.dialect.lock.PessimisticEntityLockException;
42+
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
4243
import org.hibernate.engine.spi.SessionFactoryImplementor;
4344
import org.hibernate.exception.ConstraintViolationException;
4445
import org.hibernate.exception.DataException;
4546
import org.hibernate.exception.JDBCConnectionException;
4647
import org.hibernate.exception.LockAcquisitionException;
4748
import org.hibernate.exception.SQLGrammarException;
48-
import org.hibernate.service.spi.Wrapped;
49+
import org.hibernate.service.UnknownServiceException;
4950

5051
import org.springframework.dao.CannotAcquireLockException;
5152
import org.springframework.dao.DataAccessException;
@@ -88,14 +89,22 @@ public abstract class SessionFactoryUtils {
8889
* Determine the DataSource of the given SessionFactory.
8990
* @param sessionFactory the SessionFactory to check
9091
* @return the DataSource, or {@code null} if none found
91-
* @see SessionFactoryImplementor#getConnectionProvider
92+
* @see ConnectionProvider
9293
*/
9394
@SuppressWarnings("deprecation")
9495
public static DataSource getDataSource(SessionFactory sessionFactory) {
9596
if (sessionFactory instanceof SessionFactoryImplementor) {
96-
Wrapped cp = ((SessionFactoryImplementor) sessionFactory).getConnectionProvider();
97-
if (cp != null) {
98-
return cp.unwrap(DataSource.class);
97+
try {
98+
ConnectionProvider cp = ((SessionFactoryImplementor) sessionFactory).getServiceRegistry().getService(
99+
ConnectionProvider.class);
100+
if (cp != null) {
101+
return cp.unwrap(DataSource.class);
102+
}
103+
}
104+
catch (UnknownServiceException ex) {
105+
if (logger.isDebugEnabled()) {
106+
logger.debug("No ConnectionProvider found - cannot determine DataSource for SessionFactory: " + ex);
107+
}
99108
}
100109
}
101110
return null;

0 commit comments

Comments
 (0)