Now, I have a similar problem as to the following, unanswered, post
http://forum.hibernate.org/viewtopic.php?t=136&highlight=cmt
As said, I'm using CMT with my stateless session bean.
Now the problem is that the Container doesn't invoke the rollback on
my createPerson(...) method when an exception is thrown. (unchecked exception is thrown in my case)
So yes the DB insert statement executed via Hibernate save(...) method in my code is made permanent/committed.
This very much sounds as if my Hibernate code is not aware of the CMT at all.
How would I perhaps go about determining if Hibernate system is using the JTS on my JBoss 3.2.1 server?
Any other suggestions or ideas that I can try to help me find the solution to my problem, much appreciated.
session bean snippet
----------------------
public void createPerson(Person p) {
Session s = null;
try {
Context ctx = new InitialContext();
SessionFactory factory =
(SessionFactory) ctx.lookup("java:/hibernate/HibernateFactory");
s = factory.openSession();
s.save(p);
//s.flush();
if (1==1) { // tmp test
throw new Exception("JTS test...");
}
} catch(Exception e) {
e.printStackTrace();
try {
sessionContext.setRollbackOnly();
} catch(Exception ex) {
System.out.println("Unable to doom transaction");
ex.printStackTrace();
}
} finally {
if(s!=null) try { s.close(); } catch(Exception e) {}
}
}