簡體   English   中英

EJB 調用失敗... javax.ejb.EJBTransactionRolledbackException: javax.persistence.TransactionRequiredException

[英]EJB Invocation failed ... javax.ejb.EJBTransactionRolledbackException: javax.persistence.TransactionRequiredException

我的代碼在 Weblogic 上運行良好,但我不明白為什么它在 Wildfly 10 中不起作用。

@Stateless
@Interceptors(LogInterceptor.class)
@TransactionManagement(TransactionManagementType.CONTAINER)
public class ActionPlanDaoImpl implements ActionPlanDao {

    
    /** The em. */
    @PersistenceContext
    private EntityManager em;


@Override
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void clearStage() throws DataException {
        
        try {
            final Query query = em
                    .createNamedQuery(StgGpsActionPlan.AP_DELETED_STG_RECORD);
            query.executeUpdate();
            
        } catch (final Exception e) {
            LOGGER.error("Exception Occured in clearStage method");
            
            throw new DataException(e);
        }
    }

我認為這是配置問題...謝謝您的幫助

通過在 persistence.xml 中定義容器解決了問題,添加元素:

<properties>
    <property name="eclipselink.target-server" value="JBoss" />
</properties>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM