Package org.springframework.transaction.support

Examples of org.springframework.transaction.support.TransactionTemplate.execute()


 
  @SuppressWarnings("unchecked")
  public <T> T execute(final Command<T> command) {
    TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
    transactionTemplate.setPropagationBehavior(transactionPropagation);
    T result = (T) transactionTemplate.execute(new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        return next.execute(command);
      }
    });
    return result;
View Full Code Here


        TransactionTemplate transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(new JpaTransactionManager(jpaTemplate.getEntityManagerFactory()));
        transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);

        transactionTemplate.execute(new TransactionCallback() {
            public Object doInTransaction(TransactionStatus arg0) {
                List list = jpaTemplate.find(SELECT_ALL_STRING);
                for (Object item : list) {
                    jpaTemplate.remove(item);
                }
View Full Code Here

    writer.open(null);

    try {
      TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
      transactionTemplate.setReadOnly(true);
      transactionTemplate.execute(new TransactionCallback<Object>() {

        @Override
        public Object doInTransaction(TransactionStatus status) {
          try {
            writer.write(items);
View Full Code Here

        TransactionTemplate transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(new JpaTransactionManager(jpaTemplate.getEntityManagerFactory()));
        transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);

        transactionTemplate.execute(new TransactionCallback() {
            public Object doInTransaction(TransactionStatus arg0) {
                List list = jpaTemplate.find(SELECT_ALL_STRING);
                for (Object item : list) {
                    jpaTemplate.remove(item);
                }
View Full Code Here

        TransactionTemplate transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(new JpaTransactionManager(jpaTemplate.getEntityManagerFactory()));
        transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);

        transactionTemplate.execute(new TransactionCallback() {
            public Object doInTransaction(TransactionStatus arg0) {
                List list = jpaTemplate.find(SELECT_ALL_STRING);
                for (Object item : list) {
                    jpaTemplate.remove(item);
                }
View Full Code Here

        TransactionTemplate transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(new JpaTransactionManager(jpaTemplate.getEntityManagerFactory()));
        transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);

        transactionTemplate.execute(new TransactionCallback() {
            public Object doInTransaction(TransactionStatus arg0) {
                List list = jpaTemplate.find(SELECT_ALL_STRING);
                for (Object item : list) {
                    jpaTemplate.remove(item);
                }
View Full Code Here

            appContext = new ClassPathXmlApplicationContext(defaultConfigPaths);
            final ApplicationContext fappContext = appContext;
            //BeanLocatorFactory.setApplicationContext(appContext);
             TransactionTemplate txTemplate = (TransactionTemplate) BeanLocatorFactory.getBean("transactionTemplate");

                 txTemplate.execute(new TransactionCallbackWithoutResult() {
                     public void doInTransactionWithoutResult(TransactionStatus status)
                     {
                         try {
                          
                           ObjectDAO objectDAO = (ObjectDAO)fappContext.getBean("objectDAO");
View Full Code Here

    final ActionInvocation finalInvoker = invoker;
    try
    {     
      TransactionTemplate txTemplate =(TransactionTemplate) BeanLocatorFactory.getBean("transactionTemplate");
     
      txTemplate.execute(new TransactionCallbackWithoutResult(){
        public void doInTransactionWithoutResult(TransactionStatus status) {
          try {
                        logger.debug("Begin transaction interceptor");
            finalInvoker.invoke();
                        logger.debug("End transaction interceptor");
View Full Code Here

    final ActionInvocation finalInvoker = invoker;
    try
    {     
      TransactionTemplate txTemplate =(TransactionTemplate) BeanLocatorFactory.getBean("transactionTemplate");
     
      txTemplate.execute(new TransactionCallbackWithoutResult(){
        public void doInTransactionWithoutResult(TransactionStatus status) {
          try {
                        //logger.debug("Begin transaction interceptor");
            finalInvoker.invoke();
                        //logger.debug("End transaction interceptor");
View Full Code Here

        overdueEndpoint.assertIsSatisfied();
    }

    protected void sendAMessages() {
        TransactionTemplate transaction = getMandatoryBean(TransactionTemplate.class, "transactionTemplate");
        transaction.execute(new TransactionCallbackWithoutResult() {
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                template.sendBody("direct:a", "<hello id='123'>A</hello>");
                template.sendBody("direct:a", "<hello id='124'>B</hello>");
                template.sendBody("direct:a", "<hello id='125'>C</hello>");
            }
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.