I tried the following and my transaction is still not rolling back! (Notice
I'm purposefully generating a null pointer exception in my save so I can test
this.)
Also note that, as described above, the EJBException that I'm throwing is being
handled in my interceptor which is not rethrowing it.
| @Name("viewUser")
| @Stateful
| @Conversational
| public class ViewUserAction implements ViewUser {
|
| @In(required = false)
| @Out(required = false)
| private User editUser;
|
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| (other attributes and methods removed...)
|
| public String save() {
| try {
| if (editUser.getId() == 0) {
| em.persist(editUser);
| }
|
| // throw an exception
| String user = null;
| user.toString();
| }
| catch (Exception e) {
| try {
| em.getTransaction().setRollbackOnly();
| }
| catch (Exception xe) {}
|
| throw new EJBException(e);
| }
|
| return "edituser";
| }
|
| }
|
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971436#3971436
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971436
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user