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

Luis Barreiro lbarreiro at redhat.com
Thu Jan 18 19:09:52 EST 2018


Hi Scott,

I can only comment on the initial question. No, hibernate does not 
automatically enhance entities. Entities are either enhanced at build 
time or after WildFly has pushed the right ClassTransformer (based on 
"hibernate.enhance.*" properties in persistence.xml).

I'm not aware of any plans to change the current behavior.

Regards,

Luis Barreiro

Middleware Performance Team

<https://red.ht/sig>

On 01/18/2018 09:39 PM, Scott Marlow wrote:
> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list