Examples of Transactional


Examples of com.blazebit.cdi.transaction.annotation.Transactional

  public Object applyTransaction(InvocationContext ic) throws Exception {
    Method m = ic.getMethod();
    Object targetObject = ic.getTarget();
    Class<?> targetClass = targetObject == null ? m.getDeclaringClass()
        : targetObject.getClass();
    Transactional transactionalAnnotation = AnnotationUtil.findAnnotation(
        m, targetClass, Transactional.class);
    Object ret;

    if (transactionalAnnotation == null) {
      throw new IllegalStateException(
          "The interceptor annotation can not be determined!");
    }

    if (transactionalAnnotation != null) {
      if (!transactionalAnnotation.requiresNew()) {
        boolean startedTransaction = false;

        if (utx.getStatus() != Status.STATUS_ACTIVE) {
          utx.begin();
          startedTransaction = true;
View Full Code Here

Examples of com.github.dynamicextensionsalfresco.annotations.Transactional

  /* Main operations */

  @Override
  public Object invoke(final MethodInvocation invocation) throws Throwable {
    final Transactional transactional = AnnotationUtils.findAnnotation(invocation.getMethod(), Transactional.class);
    return getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>() {

      @Override
      public Object execute() throws Throwable {
        return invocation.proceed();
      }
    }, transactional.readOnly(), transactional.requiresNew());
  }
View Full Code Here

Examples of com.google.inject.persist.Transactional

        }
    }

    private Object invoke0(MethodInvocation methodInvocation, ZookeeperEntityManager em, boolean didWeStartWork)
            throws Throwable, Exception {
        Transactional transactional = readTransactionMetadata(methodInvocation);

        final EntityTransaction txn = em.getTransaction();
        txn.begin();

        Object result;
View Full Code Here

Examples of com.google.inject.persist.Transactional

        return 5;
    }

    // TODO(dhanji): Cache this method's results.
    private Transactional readTransactionMetadata(MethodInvocation methodInvocation) {
        Transactional transactional;
        Method method = methodInvocation.getMethod();
        Class<?> targetClass = methodInvocation.getThis().getClass();

        transactional = method.getAnnotation(Transactional.class);
        if (null == transactional) {
View Full Code Here

Examples of com.google.inject.persist.Transactional

    if (!emProvider.isWorking()) {
      emProvider.begin();
      didWeStartWork.set(true);
    }

    Transactional transactional = readTransactionMetadata(methodInvocation);
    EntityManager em = this.emProvider.get();

    // Allow 'joining' of transactions if there is an enclosing @Transactional method.
    if (em.getTransaction().isActive()) {
      return methodInvocation.proceed();
View Full Code Here

Examples of com.google.inject.persist.Transactional

    }
  }

  // TODO Cache this method's results.
  private Transactional readTransactionMetadata(MethodInvocation methodInvocation) {
    Transactional transactional;
    Method method = methodInvocation.getMethod();
    Class<?> targetClass = methodInvocation.getThis().getClass();

    transactional = method.getAnnotation(Transactional.class);
    if (null == transactional) {
View Full Code Here

Examples of com.hp.hpl.jena.sparql.core.Transactional

    protected void execUpdate(GraphStore graphStore)
    {
        if ( requestFiles.size() == 0 && getPositional().size() == 0 )
            throw new CmdException("Nothing to do") ;
    
        Transactional transactional = (graphStore instanceof Transactional ) ? (Transactional)graphStore : new TransactionalNull() ;
       
        for ( Iterator<String> iter = requestFiles.iterator() ; iter.hasNext() ; )
        {
            String filename = iter.next();
            try {
                transactional.begin(ReadWrite.WRITE) ;
                execOneFile(filename, graphStore) ;
                transactional.commit() ;
            } finally { transactional.end() ; }
        }
       
        for ( Iterator<String> iter = super.getPositional().iterator() ; iter.hasNext() ; )
        {
            String requestString = iter.next();
            requestString = indirect(requestString) ;
           
            try {
                transactional.begin(ReadWrite.WRITE) ;
                execOne(requestString, graphStore) ;
                transactional.commit() ;
            } finally { transactional.end() ; }
           
           
        }
        SystemARQ.sync(graphStore) ;
View Full Code Here

Examples of com.hp.hpl.jena.sparql.core.Transactional

    protected void execUpdate(GraphStore graphStore)
    {
        if ( requestFiles.size() == 0 && getPositional().size() == 0 )
            throw new CmdException("Nothing to do") ;
    
        Transactional transactional = (graphStore instanceof Transactional ) ? (Transactional)graphStore : new TransactionalNull() ;

        for ( String filename : requestFiles )
        {
            try
            {
                transactional.begin( ReadWrite.WRITE );
                execOneFile( filename, graphStore );
                transactional.commit();
            }
            finally
            {
                transactional.end();
            }
        }

        for ( String requestString : super.getPositional() )
        {
            requestString = indirect( requestString );

            try
            {
                transactional.begin( ReadWrite.WRITE );
                execOne( requestString, graphStore );
                transactional.commit();
            }
            finally
            {
                transactional.end();
            }


        }
        SystemARQ.sync(graphStore) ;
View Full Code Here

Examples of com.sun.jersey.samples.bookmark.util.tx.Transactional

        userEntity.setUsername(jsonEntity.getString("username"));
        userEntity.setEmail(jsonEntity.getString("email"));
        userEntity.setPassword(jsonEntity.getString("password"));
       
        if (newRecord) {
            TransactionManager.manage(new Transactional(em) { public void transact() {
                em.persist(userEntity);
            }});
            return Response.created(uriInfo.getAbsolutePath()).build();
        } else {
            TransactionManager.manage(new Transactional(em) { public void transact() {
                em.merge(userEntity);
            }});
            return Response.noContent().build();
        }
    }
View Full Code Here

Examples of com.sun.jersey.samples.bookmark_em.util.tx.Transactional

        userEntity.setUsername(jsonEntity.getString("username"));
        userEntity.setEmail(jsonEntity.getString("email"));
        userEntity.setPassword(jsonEntity.getString("password"));
       
        if (newRecord) {
            TransactionManager.manage(utx, new Transactional(em) { public void transact() {
                em.joinTransaction();
                em.persist(userEntity);
            }});
            return Response.created(uriInfo.getAbsolutePath()).build();
        } else {
            TransactionManager.manage(utx, new Transactional(em) { public void transact() {
                em.merge(userEntity);
            }});
            return Response.noContent().build();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.