Is getReference() proxy feature deactivated when using bytecode enhancement?

I’m using bytecode enhancements feature to lazy load parent side association of @*ToOne mappings. Is the getReference() proxy feature turned off because of bytecode enhancements on entities? In my case, it looks like each call to getReference (on entities not cached) will hit the database.

I’m using Hibernate 5.2.16.Final

Thanks.

That sounds like an issue. You should provide a replicating test case as explained in this article.

getReference() gives a proxy object and doen’t hit the database. Also, to use bytecode enhancement to enable lazy loading you need to add : hibernate.enhancer.enableLazyInitialization set it to true and also while initialising the list of second entity in the parent entity just in annotation @OneToMany(fetch = FetchType.LAZY)