• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disable logging LazyInitializationException

 
Lakshmi Dasari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a multi-tiered application with as many as 750 and odd tables mapped using hibernate. In one of the layers, we require the domain objects mapped using hibernate, to be converted to value objects as the usage of these value objects is totally different. (This is an architecture decision and nothing much can be done to change this).

Keeping the volume of conversion code to be written in mind, a program was written to automatically convert the DO-VO and VO-DO using reflection. As expected the logs are full of LazyInitializationException. This becomes a problem as it is difficult to debug as the logs are filled with these exceptions.

We explored checking every object with Hibernate.initialize() before converting, but this is still not helpful in case of proxy objects where only the primary keys are populated and other properties are not initialized. So this still results in LazyInitializationException.

Modifying hibernate source code and removing the logging statement seems to be the only option.

Are there any more options I can try, before changing the source code?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you not just change the logging threshold for those classes that generate these exceptions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic