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?
|