Seems in hibernate 6.2 bytecode enhancement is enabled by default in org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl#EntityManagerFactoryBuilderImpl
and the it does
Probably it does some some good job, but it also starts to produce unexpected exceptions about classes that you don’t use or even know. For example I’m facing some exception OAuth2 security classes from spring while I’m not using spring outh2 security but it has some imports to something else that is actually a root cause. It is because there is no filtration by class name/package name and it tries to load any class to check if it is entity, interface or not. And this can result that loader can go through the imports and find some imports of classes that are not in the classpath. I think introducing some file name/package name regex filtration prior loading/processing class will help to mitigate those issues. Just class will be skipped by transformer/enhancer it the very beginning. Also probably it is a good idea to pre-populate it with well known packages - spring, hibernate, ehcache etc |