package session;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import domain.Customer;
import domain.Order;

@Stateless(name="XaJpaDemoBean")
public class XaJpaDemoBean {

	@PersistenceContext(name="customer") EntityManager customerEntityManager;
	@PersistenceContext(name="orders") EntityManager orderEntityManager;
	
	public Customer findCustomer(int id) {
		return customerEntityManager.find(Customer.class, id);
	}

	public void saveCustomerOrder(Customer c, Order o, Boolean succeeds) {
		System.out.println("XaJpaDemoBean.saveCustomerOrder()");
		try {

			// Update the customer entity in the database.
			c.setNumberOfOrders(c.getNumberOfOrders() + 1);
			System.out.println("XaJpaDemoBean.saveCustomerOrder(): Updated Customer with Id " + c.getId());

			// Insert the order entity in the database.
			orderEntityManager.persist(o);

			System.out.println("XaJpaDemoBean.saveCustomerOrder(): Created order with Id " + o.getId());

		} finally {	
			if (!succeeds) {
				throw new RuntimeException("XaJpaDemoBean.saveCustomerOrder(): Simulated failure!");
			}
		}
	}
}

@@ -39,16 +39,182 @@
 teless;%0A
+import javax.ejb.TransactionAttribute;%0Aimport javax.ejb.TransactionAttributeType;%0Aimport javax.ejb.TransactionManagement;%0Aimport javax.ejb.TransactionManagementType;%0A
 import j
@@ -241,24 +241,24 @@
 ityManager;%0A
-
 import javax
@@ -351,29 +351,67 @@
 less
-(name=%22XaJpaDemoBean%22
+%0A@TransactionManagement(TransactionManagementType.CONTAINER
 )%0Apu
@@ -585,16 +585,74 @@
 ager;%0A%09%0A
+%09@TransactionAttribute(TransactionAttributeType.REQUIRED)%0A
 %09public 
@@ -744,16 +744,74 @@
 d);%0A%09%7D%0A%0A
+%09@TransactionAttribute(TransactionAttributeType.REQUIRED)%0A
 %09public 

Remove unneeded name, add needed @Transaction* annotations. Even on the findCustomer method. EclipseLink is picky (right