I developed a spring data processing program using this tutorial. Then modified it by adding a new class / method to check spring @Transactional annotation.
@Transactional public void txnMethod() { repository.save(new Customer("First Customer","")); repository.save(new Customer("Second Customer","")); ... }
The above code has been compiled and executed correctly. Then I modified the code to explicitly set the distribution mode, as shown below, but it gives me a compilation error - "Distributing the undefined attribute for the Transactional annotation type"
@Transactional(propagation=Propagation.REQUIRED) public void txnMethod() { repository.save(new Customer("First Customer","")); repository.save(new Customer("Second Customer","")); ... }
How can I explicitly specify the distribution mode? Below are the dependencies in build.gradle. I'm using spring version for download 1.2.1.RELEASE
dependencies { compile("org.springframework.boot:spring-boot-starter-jdbc") compile("org.springframework.boot:spring-boot-starter-data-jpa") compile("org.springframework.boot:spring-boot-starter-web") compile ("org.springframework.boot:spring-boot-starter-tomcat") compile("com.h2database:h2") providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") }
source share