Package org.springframework.transaction.annotation

Examples of org.springframework.transaction.annotation.Transactional


     * @param args method arguments.
     * @return referred stored bean.
     * @throws UnresolvedReferenceException in case of failures, read-only methods and unresolved bean.
     */
    public T resolveBeanReference(final Method method, final Object... args) throws UnresolvedReferenceException {
        final Transactional transactional = method.getAnnotation(Transactional.class);
        if (transactional != null && transactional.readOnly()) {
            throw new UnresolvedReferenceException();
        }
        return resolveReference(method, args);
    }
View Full Code Here


    @Produce(uri = "mock:book")
    ProducerTemplate producer;

    @Consume(uri = "seda:book")
    public void handleTitle(String title) {
        Transactional tx = this.getClass().getAnnotation(Transactional.class);
        if (tx == null) {
            throw new IllegalStateException("Spring annotation-driven should have instrumented this class as @Transactional");
        }
        if (!"NEVER".equals(tx.propagation().name())) {
            throw new IllegalStateException("Should be NEVER propagation");
        }
        if (!tx.readOnly()) {
            throw new IllegalStateException("Should be read only");
        }

        if (!title.contains("in Action")) {
            throw new IllegalArgumentException("Not a book title we like");
View Full Code Here

    @EndpointInject(uri = "seda:book")
    private ProducerTemplate template;

    public void orderBook(String title) throws Exception {
        Transactional tx = this.getClass().getAnnotation(Transactional.class);
        if (tx == null) {
            throw new IllegalStateException("Spring annotation-driven should have instrumented this class as @Transactional");
        }
        if (!"REQUIRED".equals(tx.propagation().name())) {
            throw new IllegalStateException("Should be REQUIRED propagation");
        }

        if (title.startsWith("Donkey")) {
            throw new IllegalArgumentException("We don't have Donkeys, only Camels");
View Full Code Here

    @Produce(uri = "mock:book")
    ProducerTemplate producer;

    @Consume(uri = "seda:book")
    public void handleTitle(String title) {
        Transactional tx = this.getClass().getAnnotation(Transactional.class);
        if (tx == null) {
            throw new IllegalStateException("Spring annotation-driven should have instrumented this class as @Transactional");
        }
        if (!"NEVER".equals(tx.propagation().name())) {
            throw new IllegalStateException("Should be NEVER propagation");
        }
        if (!tx.readOnly()) {
            throw new IllegalStateException("Should be read only");
        }

        if (!title.contains("in Action")) {
            throw new IllegalArgumentException("Not a book title we like");
View Full Code Here

    @EndpointInject(uri = "seda:book")
    private ProducerTemplate template;

    public void orderBook(String title) throws Exception {
        Transactional tx = this.getClass().getAnnotation(Transactional.class);
        if (tx == null) {
            throw new IllegalStateException("Spring annotation-driven should have instrumented this class as @Transactional");
        }
        if (!"REQUIRED".equals(tx.propagation().name())) {
            throw new IllegalStateException("Should be REQUIRED propagation");
        }

        if (title.startsWith("Donkey")) {
            throw new IllegalArgumentException("We don't have Donkeys, only Camels");
View Full Code Here

    @Produce(uri = "mock:book")
    ProducerTemplate producer;

    @Consume(uri = "seda:book")
    public void handleTitle(String title) {
        Transactional tx = this.getClass().getAnnotation(Transactional.class);
        if (tx == null) {
            throw new IllegalStateException("Spring annotation-driven should have instrumented this class as @Transactional");
        }
        if (!"NEVER".equals(tx.propagation().name())) {
            throw new IllegalStateException("Should be NEVER propagation");
        }
        if (!tx.readOnly()) {
            throw new IllegalStateException("Should be read only");
        }

        if (!title.contains("in Action")) {
            throw new IllegalArgumentException("Not a book title we like");
View Full Code Here

        Object par = params.get(ii-1);
        String so = _jsh.serialize(par);
        serviceParameters[ii] = _jsh.deserialize(so, pts[ii]);
      }
      if (serviceMethod.isAnnotationPresent(Transactional.class)) {
        Transactional trx = serviceMethod.getAnnotation(Transactional.class);
        Preconditions.checkNotNull(transactionManager,"The method is transactionnal, but no transaction manager was detected!");
        TransactionTemplate trxTpl = new TransactionTemplate(transactionManager);
        trxTpl.setIsolationLevel(trx.isolation().value());
        trxTpl.setReadOnly(trx.readOnly());
        trxTpl.setPropagationBehavior(trx.propagation().value());
        trxTpl.setTimeout(trx.timeout());
        trxTpl.execute(new TransactionCallbackWithoutResult() {
          @Override
          protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
              serviceMethod.invoke(cmp.getComponent(), serviceParameters);
View Full Code Here

     * @param args method arguments.
     * @return referred stored bean.
     * @throws UnresolvedReferenceException in case of failures, read-only methods and unresolved bean.
     */
    public T resolveBeanReference(final Method method, final Object... args) throws UnresolvedReferenceException {
        final Transactional transactional = method.getAnnotation(Transactional.class);
        if (transactional != null && transactional.readOnly()) {
            throw new UnresolvedReferenceException();
        }
        return resolveReference(method, args);
    }
View Full Code Here

        Object par = params.get(ii-1);
        String so = _jsh.serialize(par);
        serviceParameters[ii] = _jsh.deserialize(so, pts[ii]);
      }
      if (serviceMethod.isAnnotationPresent(Transactional.class)) {
        Transactional trx = serviceMethod.getAnnotation(Transactional.class);
        Preconditions.checkNotNull(transactionManager,"The method is transactionnal, but no transaction manager was detected!");
        TransactionTemplate trxTpl = new TransactionTemplate(transactionManager);
        trxTpl.setIsolationLevel(trx.isolation().value());
        trxTpl.setReadOnly(trx.readOnly());
        trxTpl.setPropagationBehavior(trx.propagation().value());
        trxTpl.setTimeout(trx.timeout());
        trxTpl.execute(new TransactionCallbackWithoutResult() {
          @Override
          protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
              serviceMethod.invoke(cmp.getComponent(), serviceParameters);
View Full Code Here

        Object par = params.get(ii-1);
        String so = _jsh.serialize(par);
        serviceParameters[ii] = _jsh.deserialize(so, pts[ii]);
      }
      if (serviceMethod.isAnnotationPresent(Transactional.class)) {
        Transactional trx = serviceMethod.getAnnotation(Transactional.class);
        Preconditions.checkNotNull(transactionManager,"The method is transactionnal, but no transaction manager was detected!");
        TransactionTemplate trxTpl = new TransactionTemplate(transactionManager);
        trxTpl.setIsolationLevel(trx.isolation().value());
        trxTpl.setReadOnly(trx.readOnly());
        trxTpl.setPropagationBehavior(trx.propagation().value());
        trxTpl.setTimeout(trx.timeout());
        trxTpl.execute(new TransactionCallbackWithoutResult() {
          @Override
          protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
              serviceMethod.invoke(cmp.getComponent(), serviceParameters);
View Full Code Here

TOP

Related Classes of org.springframework.transaction.annotation.Transactional

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.