I was looking at the code generated by Spring Roo, and I noticed that the method persist()that it creates is specified Propagation.REQUIRES_NEW. Wouldn't a default spread be enough?
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void Entity.persist() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.persist(this);
}
Additional Information. Here is the roo log that generated this code:
// Spring Roo 1.1.0.RELEASE [rev 793f2b0] log opened at 2011-02-04 10:01:02
project --topLevelPackage org.sotest.sscce --projectName Test --java 6
// Spring Roo 1.1.0.RELEASE [rev 793f2b0] log closed at 2011-02-04 10:01:04
// Spring Roo 1.1.0.RELEASE [rev 793f2b0] log opened at 2011-02-04 10:01:06
persistence setup --database GOOGLE_APP_ENGINE --provider DATANUCLEUS
entity --class ~.entities.Entity
exit
// Spring Roo 1.1.0.RELEASE [rev 793f2b0] log closed at 2011-02-04 10:02:55
I am using a GAE database with a DN provider. I just created the object, I did not touch any files other than issuing the above roo commands. When I open Entity_Roo_Entity.aj, I get the code above.
I will try this again in the latest version of Roo and draw the same output. I will also post this topic on the Roo forum.
Update: The same code is created with Roo 1.1.1 (latest version)
source
share