import javax.annotation.Resource;
import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+import javax.persistence.TransactionRequiredException;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;
if (entityManager.isOpen()) {
entityManager.flush();
}
- } catch (Exception e) { // TODO catch the Entity manager exceptions explicitly and rethrow, but log
- // the other onees.
+ } catch (TransactionRequiredException e) {
+ throw e;
+ } catch (PersistenceException e) {
+ throw e;
+ }
+ catch (Exception e) {
LOGGER.log(Level.WARNING, "Could not flush entitymanager", e);
}
}