A JTA EntityManager cannot use getTransaction()
问题 How do I have the following code in my non-ejb application. The code works. @Override public void saveItems(Collection<T> items) { synchronized (em) { EntityTransaction tx = em.getTransaction(); try { tx.begin(); for (T item : items) { saveItem_((Class<T>) null, item); } tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } } } } In a new application I'm using EJB3 + JSF and would like to re-use the library containing the code above. My peristence unit for the new application looks