public final class GroovyProxyClassBuilder extends java.lang.Object
Builds the proxy class Hibernate instantiates for an entity.
The class is the stock Hibernate proxy class. For a Groovy entity it is wrapped in a subclass that
answers getMetaClass() through GroovyProxyMetaClassDispatcher while the interceptor has
not been assigned yet, which Groovy trait initializers running in the proxy constructor depend on.
Hibernate 5.6 gives no access to the ByteBuddyState that loads its proxy classes, and it names
every generated proxy class randomly while Grails creates a new provider for each SessionFactory, so the
stock class never repeats. The wrapper is therefore cached by entity and interfaces in a static
net.bytebuddy.TypeCache, which keeps it at one class per entity and class loader - the same outcome the
Hibernate 7 implementation gets from its ByteBuddyState.
Everything that can fail about the generated class fails here, when the proxy factory is instantiated, rather than on the first lazy load. Mirrors the Hibernate 7 implementation in grails-data-hibernate7.
| Constructor and description |
|---|
GroovyProxyClassBuilder(org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper proxyHelper) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public java.lang.Class<?> |
build(java.lang.String entityName, java.lang.Class<?> persistentClass, java.lang.Class<?>[] interfaces)
|
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
entityName - the name of the entity, used to say which entity a failure is aboutpersistentClass - the entity classinterfaces - the interfaces the proxy has to implement