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
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to