异常描述:org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.rollback当前没有事务处于活动状态
try { SessionLocal.getEntityManager().getTransaction().begin();
tl = DAO.create(Log.bean2toplink(ls));
SessionLocal.getEntityManager().getTransaction().commit();
} catch (DAOException ex) {
SessionLocal.getEntityManager().getTransaction().rollback();
throw new DAOException("probleme createLog", ex);
}
/////////////// DAO.create ////////////////////////
public T create(T obj, boolean isCallObserver, boolean forceFlush) throws DAOException {
try {
if (isCallObserver && null != SessionLocal.getSession()) {
GenericObserver.getInstance().fireBeforeAdd(SessionLocal.getSession(), obj);
}
this.em.persist(obj);
if (forceFlush) {
this.em.flush();
this.em.refresh(obj);
}
if (isCallObserver && null != SessionLocal.getSession()) {
ApplicationContext.getInstance().getSpringContext().publishEvent(new EntityCreatedEvent<>(this, SessionLocal.getSession(), obj));
GenericObserver.getInstance().fireAfterAdd(SessionLocal.getSession(), obj, 0);
}
} catch (SocketTimeoutException se){
throw new DAOException(Constante.DOME_TIMEOUT, se);
} catch (EntityExistsException | GenericObserverException ex) {
throw new EntityInsertException(ex.getMessage(), ex);
}
return obj;
}