Skip to content

Commit 328d1b7

Browse files
committed
fix bug in Hibernate.isInitialized()
it didn't work for EnhancementAsProxyLazinessInterceptor
1 parent aa88f3c commit 328d1b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hibernate-core/src/main/java/org/hibernate/Hibernate.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ public static boolean isInitialized(Object proxy) {
116116
}
117117
else if ( isPersistentAttributeInterceptable( proxy ) ) {
118118
final PersistentAttributeInterceptor interceptor = asPersistentAttributeInterceptable( proxy ).$$_hibernate_getInterceptor();
119-
return !(interceptor instanceof EnhancementAsProxyLazinessInterceptor);
119+
if (interceptor instanceof EnhancementAsProxyLazinessInterceptor) {
120+
return ( (EnhancementAsProxyLazinessInterceptor) interceptor ).isInitialized();
121+
}
122+
else {
123+
return true;
124+
}
120125
}
121126
else if ( proxy instanceof LazyInitializable ) {
122127
return ( (LazyInitializable) proxy ).wasInitialized();

0 commit comments

Comments
 (0)