Search in sources :

Example 1 with TransactionManagement

use of javax.ejb.TransactionManagement in project wildfly by wildfly.

the class TransactionManagementMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    // we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    ClassAnnotationInformation<TransactionManagement, TransactionManagementType> management = clazz.getAnnotationInformation(TransactionManagement.class);
    if (management == null) {
        return;
    }
    if (!management.getClassLevelAnnotations().isEmpty()) {
        componentConfiguration.setTransactionManagementType(management.getClassLevelAnnotations().get(0));
    }
}
Also used : TransactionManagementType(javax.ejb.TransactionManagementType) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) TransactionManagement(javax.ejb.TransactionManagement)

Example 2 with TransactionManagement

use of javax.ejb.TransactionManagement in project Payara by payara.

the class TransactionManagementHandler method processAnnotation.

protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
    TransactionManagement tmAn = (TransactionManagement) ainfo.getAnnotation();
    String tmType = TransactionManagementType.CONTAINER.equals(tmAn.value()) ? EjbDescriptor.CONTAINER_TRANSACTION_TYPE : EjbDescriptor.BEAN_TRANSACTION_TYPE;
    for (EjbContext ejbContext : ejbContexts) {
        EjbDescriptor ejbDesc = (EjbDescriptor) ejbContext.getDescriptor();
        // override by xml
        if (ejbDesc.getTransactionType() == null) {
            ejbDesc.setTransactionType(tmType);
        }
    }
    return getDefaultProcessedResult();
}
Also used : EjbContext(com.sun.enterprise.deployment.annotation.context.EjbContext) EjbDescriptor(org.glassfish.ejb.deployment.descriptor.EjbDescriptor) TransactionManagement(javax.ejb.TransactionManagement)

Aggregations

TransactionManagement (javax.ejb.TransactionManagement)2 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)1 TransactionManagementType (javax.ejb.TransactionManagementType)1 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)1 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1