[jboss-user] [JBoss Seam] - Re: Exception:Transaction is not active
mnrz
do-not-reply at jboss.com
Tue Oct 23 08:21:49 EDT 2007
Thank you very much indeed
just two questions.
if we mark the class with @Transactional, will it manage all transaction?
second, is this right?
| public int save(StoredQuery query) {
| try {
| em.getTransaction().begin();
| em.persist(query);
| em.getTransaction().commit();
| return 0;
| } catch (Exception e) {
| em.getTransaction().rollback();
| e.printStackTrace();
| return -1;
| }
| }
|
|
I change that save() method to rollback transaction to prevent above problem, but it throws this exception:
java.lang.IllegalStateException: Illegal to call this method from injected, managed EntityManager
what is wrong with this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097866#4097866
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097866
More information about the jboss-user
mailing list