[hibernate-dev] Does Hibernate ORM bytecode enhance application entity classes by default?

Scott Marlow smarlow at redhat.com
Thu Jan 18 16:39:49 EST 2018


Hi,

Did we change Hibernate to automatically enhance/rewrite application 
entity classes by default?  I remember hearing a few times that we would 
but don't remember if that happened.

This is related to WildFly jira WFLY-8858 [1], which I'm not yet sure of 
how to completely fix (involves deal with multiple deployment ordering 
problems with application level datasources, CDI beanmanagers, parallel 
application deployment and application entity class enhancement).

One WildFly issue is that the application datasources aren't available 
until late in WildFly deployment but the JPA container needs to register 
the JPA classloader level transformers very early, so Hibernate can 
rewrite application classes.  This is further complicated by our WildFly 
CDI implementation needing to read application class definitions.

I wonder if it could make sense for 
org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder to have a 
separate way to register the ClassTransformer transformer early and 
trigger the PU bootstrap on the first call to registered 
ClassTransformer's.  If that doesn't happen, then we defer bootstrap 
until EntityManagerFactoryBuilder.build() is called.

Scott

[1] https://issues.jboss.org/browse/WFLY-8858


More information about the hibernate-dev mailing list