Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 返回的无状态会话Bean方法未完成事务_Java_Jpa_Glassfish 4 - Fatal编程技术网

Java 返回的无状态会话Bean方法未完成事务

Java 返回的无状态会话Bean方法未完成事务,java,jpa,glassfish-4,Java,Jpa,Glassfish 4,我使用glassfish 4.1 我的代码是 @Stateless @TransactionManagement(TransactionManagementType.BEAN) public class IslemEJB<T, U> { @PersistenceContext(unitName = "etobsSentinelPU") private EntityManager em; @Resource private

我使用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) {...}
@无状态
@TransactionManagement(TransactionManagementType.BEAN)
公共类IslemEJB{
@PersistenceContext(unitName=“etobsentinelpu”)
私人实体管理者;
@资源
私有用户事务;
私人T;
私立大学;
公共T updateMessageSizWithReturn(T){
试一试{
ut.begin();
t=em.merge(t);
em.flush();
System.out.println(“日志id”+t);
ut.commit();
}
catch(RollbackException | HeuristicMixedException | HeuristicRollbackException |非法状态异常| NotSupportedException | SystemException ex){
Logger.getLogger(IslemEJB.class.getName()).log(Level.SEVERE,null,ex);
系统输出打印项次(ex);
mesaj=“Hata:Güncelleme işlemi sırasında Hata meydana geldi。”;
硬粒=假;
} 
catch(SecurityException ex){…}

并且错误是在应用程序启动时未完成事务而返回的无状态会话Bean方法。

您可以共享
catch
块吗?因为在
em.flush()
期间可能会出现
RuntimeException
,在这种情况下不会调用
ut.commit()
}catch(RollbackException | HeuristicMixedException | HeuristicRollbackException | IllegalStateException | NotSupportedException | SystemException ex){Logger.getLogger(IslemEJB.class.getName()).log(Level.severy,null,ex);System.out.println(ex);mesaj=“Hata:Güncelleme işlemi sırasıHata meydana geldi。”;durum=false;}catch(SecurityException ex){
您可以共享您的
catch
块吗?因为在
em.flush()
期间可能会出现
RuntimeException
,在这种情况下,不会调用
ut.commit()
}catch(RollbackException | HeuristicMixedException | HeuristicRollbackException | IllegalStateException | NotSupportedException | SystemException ex){Logger.getLogger(IslemEJB.class.getName()).log(Level.severy,null,ex);System.out.println(ex);mesaj=“Hata:Güncelleme işlemi sırasıHata meydana geldi。”;durum=false;}catch(SecurityException ex){