I developed a spring data jpa program using this tutorial. Then modified it by adding a new class/method to test spring's @Transactional annotation.
@Transactional
public void txnMethod() {
repository.save(new Customer("First Customer",""));
repository.save(new Customer("Second Customer",""));
...
}
The above code compiled and executed correctly. Then I modified the code to explictly set propagation mode as shown below, but this gives me a compilation error - "The attribute propagation is undefined for the annotation type Transactional"
@Transactional(propagation=Propagation.REQUIRED)
public void txnMethod() {
repository.save(new Customer("First Customer",""));
repository.save(new Customer("Second Customer",""));
...
}
How can I specify the propagation mode explicitly ? Below are the dependencies in build.gradle. Am using spring boot version 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")
}