gavin wrote:
However, it is VERY easy to write a wrapper for the Hibernate Session that converts exceptions, or to use a fwk like Spring that does this.
Somehow, I see it as follows. The problem is that there are many methods to dispatch, i.e. it's boring. A better way, anyone? Thanks
Code:
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
public class MySessionWrapper {
private Session hbSession;
// dispatch ALL hbSession methods as follows
public Transaction beginTransaction() {
try {
return hbSession.beginTransaction();
} catch (Exception e) {
throw new RuntimeException("Whatever ...");
}
....
}