Polishing
This commit is contained in:
parent
e4753c9f8b
commit
1ad7a03357
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
|
@ -20,12 +20,13 @@ import java.sql.Connection;
|
|||
|
||||
/**
|
||||
* Simple interface to be implemented by handles for a JDBC Connection.
|
||||
* Used by JdoDialect, for example.
|
||||
* Used by JpaDialect and JdoDialect, for example.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1
|
||||
* @see SimpleConnectionHandle
|
||||
* @see ConnectionHolder
|
||||
* @see org.springframework.orm.jdo.JpaDialect#getJdbcConnection
|
||||
* @see org.springframework.orm.jdo.JdoDialect#getJdbcConnection
|
||||
*/
|
||||
public interface ConnectionHandle {
|
||||
|
|
|
|||
|
|
@ -340,14 +340,14 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
|||
|
||||
private static class HibernateConnectionHandle implements ConnectionHandle {
|
||||
|
||||
private final Session session;
|
||||
|
||||
// This will find a corresponding method on Hibernate 3.x but not on 4.x
|
||||
private static final Method sessionConnectionMethod =
|
||||
ClassUtils.getMethodIfAvailable(Session.class, "connection");
|
||||
|
||||
private static volatile Method connectionMethodToUse = sessionConnectionMethod;
|
||||
|
||||
private final Session session;
|
||||
|
||||
public HibernateConnectionHandle(Session session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
|||
public static Connection doGetConnection(Session session) {
|
||||
try {
|
||||
if (connectionMethodToUse == null) {
|
||||
// Reflective lookup trying to find SessionImpl's connection() on Hibernate 4.x
|
||||
// Reflective lookup to find SessionImpl's connection() method on Hibernate 4.x
|
||||
connectionMethodToUse = session.getClass().getMethod("connection");
|
||||
}
|
||||
return (Connection) ReflectionUtils.invokeMethod(connectionMethodToUse, session);
|
||||
|
|
|
|||
Loading…
Reference in New Issue