I have a Session EJB that calls the remove() method on an Entity bean. The remove() method deletes several rows in different tables in the database (Sybase). If one of the delete fails, I catch the SQLException and throw an EJBException so the container rolls back the transaction. The problem is that any deletes that completed successfuly do not rollback leaving the DB in a bad state.
To (kind of) replicate the problem, I intentionally throw an EJBException at the end of the ejbRemove() method, in which case all DELETE statements should rollback, but do not.
Am I not understanding the EJB specs properly? Does anybody have an explanation and/or solution?
I suggest u that 1st u check whether ur tables supports transaction if yes try following code
UserTransaction ut = null;
InitialContext initial = new InitialContext();
UserTransaction ut = (UserTransaction)initial.lookup("java:comp/UserTransaction");
////Ur Transaction queries here
may this help u