Nams
Nams

Reputation: 31

Weblogic 12c, Spring boot transaction rollback not working with rollbackFor

I have written a sample application with Spring boot and JPA. I am using spring transaction management. I have 2 inserted 2 records and after that have deliberately thrown Exception and used @Transactional(rollbackFor =Exception.class). It works fine in tomcat, whole transaction is rollbacked as expected.

But this doesn't work with weblogic server. It persist 2 records. Is there any solution to this ? I want to rollback my complete transaction.

   class A{
      @Transactional(rollbackFor =Exception.class)
      public void b(){
        save(object1);
        save(object2);
        throw new Exception();
      }
   }

Upvotes: 3

Views: 852

Answers (1)

Eddy Angel
Eddy Angel

Reputation: 11

you need to define a jdni in your weblogic, then define in your application.properties spring.datasource.jndi-name=jdbc/oracle where jdbc/oracle is the jdni defined in the weblogic.

it worked for me

Upvotes: 1

Related Questions