I have bean with @TransactionAttribute(TransactionAttributeType.NEVER) and method with @TransactionAttribute(TransactionAttributeType.SUPPORTS) but when method is executed looks like sometimes, not always method @TransactionAttribute(TransactionAttributeType.SUPPORTS) annotation is ignored and it failed with this error. I have Jboss EAP 7.3.9 standalone-full application. ORM provided is eclipselink. Code:
@Stateless
@TransactionAttribute(TransactionAttributeType.NEVER)
@Interceptors(ServiceExceptionInterceptor.class)
public class UserServiceImpl extends GenericCountry<LanguageDefinition> implements UserService {
@Override
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public UserDto getUserByUsername(String username) {
return userFacade.getUserByUsername(username);
}
public interface UserService {
UserDto getUserByUsername(String username);
}
standalone-full.xml datasource section :
<datasources>
<datasource jta="true" jndi-name="java:/jdbc/test" pool-name="test2" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:@localhost:9090:ddjboss</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>15</max-pool-size>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
<allow-multiple-users>false</allow-multiple-users>
</pool>
<security>
<user-name>111</user-name>
<password>111</password>
</security>
</datasource>
persistence.xml file.
<persistence-unit name="test" transaction-type="JTA" >
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/test2</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<!--<properties>-->
<!--<property name="eclipselink.logging.level.sql" value="FINE"/>-->
<!--<property name="eclipselink.logging.parameters" value="true"/>-->
<!--<property name="eclipselink.logging.logger" value="DefaultLogger"/>-->
<!--</properties>-->
<properties>
<property name="eclipselink.target-database" value="Oracle"/>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
</properties>
</persistence-unit>
Caused by: javax.ejb.EJBException: WFLYEJB0063: Transaction present on server in Never call (EJB3 13.6.2.6) at org.jboss.as.ejb3.tx.CMTTxInterceptor.never(CMTTxInterceptor.java:349) at org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:62)
What could be the problem? look like sometimes annotation inheritance for @TransactionAttribute is not working.