[hibernate-dev] Introducing a "none" BytecodeProvider
Sanne Grinovero
sanne at hibernate.org
Wed Oct 17 11:50:05 EDT 2018
After some experimentation I figured out that the BytecodeProvider is
not really necessary, if you are happy to use the tools we have to
enhance the entities upfront.
In some environments such as on GraalVM I need to pre-enhance the
entities (need as in "not optional"), but some further things would be
really much simpler if I then could exclude Byte Buddy from runtime
dependencies.
As the code stands today, the Byte Buddy engine is loaded very early
during bootstrap (even if the entities are already enhanced, as we
didn't test for that yet at this point) and can't be disabled.
I have a successful experiment which introduces a "none" configuration
value for the "hibernate.bytecode.provider" property which allows me
to fully disable the need to have ByteBuddy on classpath at runtime.
I would not generally recommend this as there is no safety net: if you
set this property AND did not enhance your entities, I expect trouble.
Also there's a strong limitation: I could not implement the
`BasicProxyFactory`, which is probably making this unfit for general
purpose; I could use some help to nail down why exactly we need this
and see if we can actually implement an alternative - possibly having
the build time entity enhancement tools generate the necessary
bytecode upfront?
Still, I'd propose to merge this feature as an advanced feature that
some power users will need when making progress on support for new
platforms. Because of this experimental aspect, I'm not bothering to
mention it on the user guide :)
Ok?
Thanks,
Sanne
More information about the hibernate-dev
mailing list