>From the EJB3 Persistence spec (section 5.3, page 116) it says to use:
EntityManagerFactory emf =
  | javax.persistence.Persistence.createEntityManagerFactory("Order");
  | EntityManager em = emf.createEntityManager();
when working in a Java SE environment. 

When working in an EE container use injection/JNDI lookup. For example:
@Stateless
  | @TransactionManagement(TransactionManagementType.BEAN)
  | public class TravelAgentBean {
  | 
  | @PersistenceUnit(unitName="titan")
  | private static EntityManagerFactory factory;
  | ...}
  | 

ps. you can get a UserTransaction with: @Resource UserTransaction tx; if you 
want to avoid the jndi lookup.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067973#4067973

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067973
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to