This content has been marked as final.
Show 2 replies
-
1. Re: NoResultException causes transaction to rollback
tekchandp Jun 24, 2009 4:27 PM (in response to acerberus)you can change your Method getRoleByName something like this and based on return value you can perform your operation
boolean ret = false; Role r = (Role)entityManager.createQuery("query").setParameter("parameter",name).getSingleresult(); if(r==null){ ret = true; } return ret;
-
2. Re: NoResultException causes transaction to rollback
acerberus Jun 24, 2009 6:31 PM (in response to acerberus)True. But what strikes me is as odd is that I cannot use Seam's Query component since it throws the NoResultException and thereby causes the current transaction to rollback. I would almost go as far as calling this a bug in Seam since the official documentation of NoResultException says:
Thrown by the persistence provider when getSingleResult() is executed on a query and there is no result to return. This exception will not cause the current transaction, if one is active, to be marked for roll back.(see NoResultException JavaDoc)
So why does Seam ignore this making the Query component almost useless?