Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to prevent lazy initialization on a proxy  RSS feed

Didier Varon
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have two entities (EntityA, EntityB), linked this way:

In my process I load a EntityB by getting proxies as follows:

Then I create an EnittyA

I do this for thousands of records, and when I persist those EntityA objects, Hibernate tries to initialize the proxies, I can see hibernate logging
Hibernate: /* load com.somecompany.bean.EnitityB */

Is there any way to let hibernate know that I don't want those proxies to be initialized?

Many thanks
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!