[hibernate-dev] Bytecode enhancement configuration

Luis Barreiro lbarreiro at redhat.com
Fri Dec 4 01:29:07 EST 2015


Hi all,

I would like to start a discussion to know what is the general opinion 
about $subject, triggered by HHH- 10356.
I'm also taking the opportunity to hear about some considerations I have 
on the configuration of the build-time plugins.
*
**
**- Run time*

     Right now it is not possible to configure runtime enhancement. The 
'hibernate.ejb.use_class_enhancer' property in persistence.xml is used 
to enable runtime enhancement, but unlike the build-time plugins there 
is no way to configure what functionalities are enabled. 
DefaultEnhancementContext is always used. My propose is to define a new 
set of properties, one for each of the features:
     (the names of the properties here are chosen to match the names in 
the build-time plugins)
         'hibernate.enhance.enableLazyInitialization'
         'hibernate.enhance.enableDirtyTracking'
         'hibernate.enhance.enableAssociationManagement'

     Regarding the existing property, I think the best is to deprecate 
it. If it's used, show an warning message with instructions to update 
the configuration.

*
**- Build time*

     Since we are on the subject, I would like to hear everyone's 
opinion about changing the default values for each of the features in 
the build time plugins. These would be all disabled by default, to be 
consistent with runtime enhancement. Due to the nature of bytecode 
enhancement, developers can sometime be caught by surprise since the 
code they see in the IDE is not what ends up being deployed. Having to 
enable each of the features makes developers more aware of what to expect.
     It will also help to getter better bug reports. Something like 'I 
enabled feature X and Y start to fail' will give us clues on the 
possible issue.
     To help current users unaware of this change, a warn should be 
printed if a plugin runs without any feature enabled.

     Finally, as part of issue HHH-10354 I propose renaming the 
undocumented feature 'enableFieldAccessEnhancement' to 
'enableExtendedEnhancement' --- the big warning around it is to keep !!!


Regards,

-- 
Luis Barreiro
JBoss^® by Red Hat


More information about the hibernate-dev mailing list