I catched a LazyInitializationException as a workarround for a Grails issue (
http://jira.codehaus.org/browse/GRAILS-2764), but the stacktrace still appeared in logs.
Looking Hibernate source code I found this little jewel:
Code:
public LazyInitializationException(String msg) {
super(msg);
LogFactory.getLog(LazyInitializationException.class).error(msg, this);
}
So I ended up putting this rather nasty line in the log4j config file:
Code:
log4j.logger.org.hibernate.LazyInitializationException=FATAL
Anybody knows if there are any plans or open issue in order to make Hibernate exceptions really catchable? In the mean time, is there any other workaround?