Why Spring Roo gives persist () Propogation.REQUIRES_NEW

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)

+3
source share
1 answer

SECOND ANSWER ( , ​​ )

, GAE. GAE . . GAE . :

, .... . , . , , , , .

. , , REQUIRES_NEW, "" , . , , , GAE.

- . Roo v1.1.1 Hibernate, . :

   Spring  (Propagation.REQUIRED,   Isolation.DEFAULT).

Propagation.REQUIRES_NEW .

Roo, , . , , . /:

1: . , , , GAE/DN. . GAE: http://code.google.com/appengine/docs/java/datastore/transactions.html.

+2

Source: https://habr.com/ru/post/1789363/


All Articles