[hibernate-dev] Is bytecode enhancement enabled by default in 5.3?
Scott Marlow
smarlow at redhat.com
Fri May 25 10:26:21 EDT 2018
On 05/23/2018 09:17 AM, Steve Ebersole wrote:
> I never understood this `DataSourceDefinitions` part. Why can't they
> just be discovered via jipijapa prior to doing anything with Hibernate/JPA?
The @DataSourceDefinition DataSource that ORM needs, doesn't start until
after application classes are loaded/defined.
>
> See inline...
>
> Steve Ebersole and I have talked about adding additional phases to the
> PU bootstrap, but that was so long ago, I forget if it was about
> registering the ORM class transformer [1] earlier. If ORM 5.3 or 6.0,
> is depending on [1] to work correctly in order to implement the ORM
> features, we need to take some action.
>
>
> So the rub right now (up through and including) 5.3 is that we sometimes
> load domain model Class references during this "first bootstrap phase".
> What really needs to happen is for Hibernate to unequivocally delay
> loading domain model Class references until after this phase is over -
> at least delay loading them into the "real" ClassLoader, we can use the
> JPA temp ClassLoader if it is available.
>
> 6.0 will delay loading these Class references even more so than today.
> However, even with 6.0 we cannot fully guarantee that we will never load
> them during this 1st phase. That is a design goal for 7.0 and the move
> to Jandex.
>
> In the past, I recall someone mentioning that lazy loading or dirty
> flag
> handling, would depend on bytecode enhancing. If that happened or will
> happen, we should discuss what the fallback solution is for when
> bytecode enhancing is not working.
>
>
> Bytecode enhancement is not needed for either of these - Hibernate can
> (and has forever) supported these without enhancement. That will
> continue to be the case. Bytecode enhancement is simply an alternative
> means for adding these features.
This is good news, so applications will still work correctly.
>
> However, certain features such as automatic bi-dir association
> management does require enhancement to work.
Should we document that applications with entity classes using bi-dir
association, also depend on enhancement working? And also mention why
run-time enhancement might not work and perhaps mention build-time
enhancement as a workaround to run-time enhancement not working?
>
> Another subject, is how should a user find out that bytecode enhancing
> is actually updating application entity classes. Should that operation
> have trace logging and should that be at the WF or ORM level?
>
>
> Well based on what you described it sounds to me like there ought to be
> at least 2 different log events here:
>
> 1. The transformer is registered (this could be either WF or Hibernate
> or both)
> 2. The transformer calls the Enhancer
https://issues.jboss.org/browse/WFLY-10456 is for #1 + #2.
> 3. (?) Enhancer enhances a class. Enhancer is an interface though and
> this would rely on the impls (Javassist and Byte Buddy) to do this.
>
+10 for ORM to also log #2 + #3. :)
Scott
More information about the hibernate-dev
mailing list