簡體   English   中英

EJB全球交易管理

[英]Ejb global transaction management

有沒有一種方法可以在EJB的一個“位置”中配置事務? 我知道我可以使用@TransactionManagement但是它需要將此注釋添加到每個bean中,並且默認事務屬性為REQUIRED 我要實現的是在整個項目中禁用事務。 我試着用創建自定義的注釋@Stereotype但它不隨工作@Singleton 然后發生此錯誤:

[2019-07-20T08:17:31.918+0200] [Payara 5.191] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=172 _ThreadName=admin-thread-pool::admin-listener(5)] [timeMillis: 1563603451918] [levelValue: 1000] [[
  Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI definition failure:WELD-001508: Cannot create an InjectionTarget from [EnhancedAnnotatedTypeImpl] public abstract interface @Stereotype @Singleton @Target @TransactionAttribute @Retention class pl.orangelabs.hod.app.config.NoTransactionComponent as it is an int
erface -- WELD-001508: Cannot create an InjectionTarget from [EnhancedAnnotatedTypeImpl] public abstract interface @Stereotype @Singleton @Target @TransactionAttribute @Retention class pl.orangelabs.hod.app.config.NoTransactionComponent as it is an interface
        at org.jboss.weld.util.InjectionTargets.createNonProducibleInjectionTarget(InjectionTargets.java:82)
        at org.jboss.weld.util.InjectionTargets.createNonProducibleInjectionTarget(InjectionTargets.java:48)
        at org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:126)
        at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88)

我正在使用Payara server來部署應用程序。

設置了EJB的默認事務性,但是您可以通過使用CDI-Beans避免使用本地Ejb。 如果它們有點單調或無狀態,請定義它們ApplicationScoped,RequestScoped或SessionScoped,並在需要它們的地方使用@Inject。

暫無
暫無

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

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