Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

in EJB3, is there still need Container-Managed Transaction (CMT) Demarcation  RSS feed

 
peter tong
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in EJB3, is there still need to write something like
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public CustomerOrder createCustomerOrderUsingSupports(Customer customer)
throws Exception { ... }

also, if I write
@PersistenceContext
private EntityManager em;

public void method1(){
em.persist(object1);
em.persist(object2);
};

if em.persist(object2) has exception, will object1 rollback? (assume method 1 has not write any @TransactionAttribute explicitly)
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not required.
It's available.
Chapter 16, Enterprise Javabeans 3.0 is a good resource.

yes, if method1() is on an session bean, the whole thing will roll back without explicit transaction demarcation
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!