Package javax.ejb

Examples of javax.ejb.TransactionManagementType


   {
      super(property);
     
      if (container instanceof EJBContainer)
      {
         TransactionManagementType type = TxUtil.getTransactionManagementType(((EJBContainer) container).getAdvisor());
         if (type != TransactionManagementType.BEAN)
            throw new IllegalStateException("Container " + ((Container) container).getEjbName() + ": it is illegal to inject UserTransaction into a CMT bean");
      }
   }
View Full Code Here


      }
   }

   public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException
   {
      TransactionManagementType mtype = TxUtil.getTransactionManagementType(container.getAdvisor());
      if (mtype == javax.ejb.TransactionManagementType.BEAN) return false;


      TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(method, TransactionAttribute.class);
      if (attr == null)
View Full Code Here

                assert annotations.size() == 1 : "@TransactionManagement can only be on the class itself";
                final AnnotationValue annotationValue = annotations.get(0).value();
                // annotation value can be null if the user specifies @TransactionManagement without any explicit value.
                // Jandex API doesn't return the "default" value and that's the expected API behaviour
                // https://issues.jboss.org/browse/AS7-1506
                final TransactionManagementType txManagementType = annotationValue == null ?
                        TransactionManagementType.CONTAINER : TransactionManagementType.valueOf(annotationValue.asEnum());
                componentDescription.setTransactionManagementType(txManagementType);
            }
        }
    }
View Full Code Here

    * @return true when CMT
    */
   @XmlTransient
   public boolean isCMT()
   {
      TransactionManagementType type = getTransactionType();
      if (type == null)
         return true;
      else
         return type == TransactionManagementType.CONTAINER;
   }
View Full Code Here

                /*
                 * @TransactionManagement
                 */
                if (bean.getTransactionType() == null) {
                    final TransactionManagement tx = getInheritableAnnotation(clazz, TransactionManagement.class);
                    TransactionManagementType transactionType = TransactionManagementType.CONTAINER;
                    if (tx != null) {
                        transactionType = tx.value();
                    }
                    switch (transactionType) {
                        case BEAN:
View Full Code Here

      if(currentInvocation == null)
         throw new IllegalStateException("It's not allowed to do getRollbackOnly() during construction and injection");
      Advisor advisor = currentInvocation.getAdvisor();
     
      // EJB1.1 11.6.1: Must throw IllegalStateException if BMT
      TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
      if (type != TransactionManagementType.CONTAINER)
         throw new IllegalStateException("Container " + advisor.getName() + ": it is illegal to call getRollbackOnly from BMT: " + type);

      if(isLifecycleCallback(currentInvocation))
         throw new IllegalStateException("getRollbackOnly() not allowed during lifecycle callbacks (EJB3 4.4.1 & 4.5.2)");
View Full Code Here

     
      if(InvocationHelper.isInjection(invocation))
         throw new IllegalStateException("getUserTransaction() not allowed during injection (EJB3 4.4.1 & 4.5.2)");
     
      Advisor advisor = invocation.getAdvisor();
      TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
      if (type != TransactionManagementType.BEAN) throw new IllegalStateException("Container " + advisor.getName() + ": it is illegal to inject UserTransaction into a CMT bean");

      return new UserTransactionImpl();  
   }
View Full Code Here

      if(currentInvocation == null)
         throw new IllegalStateException("It's not allowed to do setRollbackOnly() during construction and injection");
      Advisor advisor = currentInvocation.getAdvisor();
     
      // EJB1.1 11.6.1: Must throw IllegalStateException if BMT
      TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
      if (type != TransactionManagementType.CONTAINER) throw new IllegalStateException("Container " + advisor.getName() + ": it is illegal to call setRollbackOnly from BMT: " + type);

      if(isLifecycleCallback(currentInvocation))
         throw new IllegalStateException("setRollbackOnly() not allowed during lifecycle callbacks (EJB3 4.4.1 & 4.5.2)");
     
View Full Code Here

   @Override
   public Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
   {
      // We have to do this until AOP supports matching based on annotation attributes
      TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
      if (type == TransactionManagementType.BEAN)
         return new NullInterceptor();

      TransactionManager tm = this.getTransactionManager();
     
View Full Code Here

   private void addTransactionAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean, String ejbName)
      throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException
   {
      if (enterpriseBean != null)
      {
         TransactionManagementType transactionType = enterpriseBean.getTransactionType();
         if (transactionType != null)
         {
            TransactionManagementImpl annotation = new TransactionManagementImpl();
            annotation.setValue(transactionType);
            addClassAnnotation(container, TransactionManagement.class, annotation);
View Full Code Here

TOP

Related Classes of javax.ejb.TransactionManagementType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.