我使用glassfish 4.1 我的代码是
@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class IslemEJB<T, U> {
@PersistenceContext(unitName = "etobsSentinelPU")
private EntityManager em;
@Resource
private UserTransaction ut;
private T t;
private U u;
public T updateMesajsizWithReturn(T t) {
try {
ut.begin();
t = em.merge(t);
em.flush();
System.out.println(" Log id " + t);
ut.commit();
}
catch (RollbackException | HeuristicMixedException | HeuristicRollbackException | IllegalStateException | NotSupportedException | SystemException ex) {
Logger.getLogger(IslemEJB.class.getName()).log(Level.SEVERE, null, ex);
System.out.println(ex);
mesaj = "Hata : Güncelleme işlemi sırasında hata meydana geldi. ";
durum = false;
}
catch (SecurityException ex) {...}
错误是在启动应用程序时未完成事务而返回的无状态会话Bean方法。