• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Disable logging LazyInitializationException

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you not just change the logging threshold for those classes that generate these exceptions?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic