Author: gbadner
Date: 2009-12-24 02:58:35 -0500 (Thu, 24 Dec 2009)
New Revision: 18325
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java
Log:
HHH-4735 : Proxy can be associated with a new session when it is already connected to a
different one (minor change for perf)
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java
===================================================================
---
core/branches/Branch_3_3/core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java 2009-12-24
07:56:51 UTC (rev 18324)
+++
core/branches/Branch_3_3/core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java 2009-12-24
07:58:35 UTC (rev 18325)
@@ -106,13 +106,14 @@
*/
public final void setSession(SessionImplementor s) throws HibernateException {
if ( s != session ) {
- if ( isConnectedToSession() ) {
+ // check for s == null first, since it is least expensive
+ if ( s == null ){
+ unsetSession();
+ }
+ else if ( isConnectedToSession() ) {
//TODO: perhaps this should be some other RuntimeException...
throw new HibernateException("illegally attempted to associate a proxy with two
open Sessions");
}
- else if ( s == null ){
- unsetSession();
- }
else {
session = s;
}
Show replies by date