jamesfredley commented on PR #15548: URL: https://github.com/apache/grails-core/pull/15548#issuecomment-4180133056
@jdaugherty You're right - Groovy proxies (`GroovyProxyFactory`/`ProxyInstanceMetaClass`) are not the default proxy mechanism for Hibernate. The TCK `GroovyProxySpec` is `@IgnoreIf` for both H5 and H7 with the comment: *"this test is ignored because Groovy proxies are not used with Hibernate"*. Hibernate uses its own proxy mechanism (ByteBuddy/Javassist `HibernateProxy` instances). H7's `ByteBuddyGroovyProxyFactory` creates Hibernate proxies enhanced with Groovy-aware interception - these are NOT "Groovy proxies" in the `GroovyProxyFactory` sense. However, H5's `HibernateProxyHandler.isInitialized()` already had a defensive `ProxyInstanceMetaClass` check ([here](https://github.com/apache/grails-core/blob/spring-boot-4/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java)) to handle the edge case where someone overrides the `proxyFactory` (as `Hibernate7GroovyProxySpec` demonstrates by manually setting `proxyFactory = new GroovyProxyFactory()`). Without this check, `Hibernate.isInitialized()` returns `true` for any non-`HibernateProxy` object - silently giving wrong answers for Groovy proxies. This PR restores that same defensive behavior in H7's handler for parity. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
