Search in sources :

Example 1 with CommitAfter

use of org.apache.tapestry5.hibernate.annotations.CommitAfter in project tapestry-5 by apache.

the class CachedForm method onSuccess.

@CommitAfter
void onSuccess() {
    User user = new User();
    user.setFirstName(name);
    session.save(user);
}
Also used : User(org.example.app0.entities.User) CommitAfter(org.apache.tapestry5.hibernate.annotations.CommitAfter)

Example 2 with CommitAfter

use of org.apache.tapestry5.hibernate.annotations.CommitAfter in project tapestry-5 by apache.

the class EncodeEntities method onCreate.

@CommitAfter
void onCreate() {
    User user = new User();
    user.setFirstName("name");
    session.save(user);
}
Also used : User(org.example.app0.entities.User) CommitAfter(org.apache.tapestry5.hibernate.annotations.CommitAfter)

Example 3 with CommitAfter

use of org.apache.tapestry5.hibernate.annotations.CommitAfter in project tapestry-5 by apache.

the class GridDemo method onActionFromSetup.

@CommitAfter
void onActionFromSetup() {
    userDAO.deleteAll();
    for (int i = 1; i <= 20; i++) {
        User user = new User();
        String suffix = String.valueOf(i);
        user.setFirstName("Joe_" + suffix);
        user.setLastName("User");
        user.setEncodedPassword("####");
        user.setEmail("joe" + suffix + "@null.com");
        session.persist(user);
    }
}
Also used : User(org.example.app0.entities.User) CommitAfter(org.apache.tapestry5.hibernate.annotations.CommitAfter)

Example 4 with CommitAfter

use of org.apache.tapestry5.hibernate.annotations.CommitAfter in project tapestry-5 by apache.

the class TopLevelServiceImpl method createThingOneAndTwo.

@Override
@CommitAfter
public void createThingOneAndTwo(String nameOne, String nameTwo) {
    ThingOne thingOne = new ThingOne();
    thingOne.setName(nameOne);
    em.persist(thingOne);
    nestedService.createThingTwo(nameTwo);
}
Also used : ThingOne(org.apache.tapestry5.jpa.test.entities.ThingOne) CommitAfter(org.apache.tapestry5.jpa.annotations.CommitAfter)

Example 5 with CommitAfter

use of org.apache.tapestry5.hibernate.annotations.CommitAfter in project tapestry-5 by apache.

the class TopLevelServiceImpl method createThingOneThenTwo.

@Override
@CommitAfter
public void createThingOneThenTwo(final String nameOne, final String nameTwo) {
    entityTransactionManager.invokeAfterCommit(null, new Invokable<Boolean>() {

        @Override
        public Boolean invoke() {
            nestedService.createThingTwo(nameTwo);
            return true;
        }
    });
    ThingOne thingOne = new ThingOne();
    thingOne.setName(nameOne);
    em.persist(thingOne);
}
Also used : ThingOne(org.apache.tapestry5.jpa.test.entities.ThingOne) CommitAfter(org.apache.tapestry5.jpa.annotations.CommitAfter)

Aggregations

CommitAfter (org.apache.tapestry5.jpa.annotations.CommitAfter)17 PersistenceContext (javax.persistence.PersistenceContext)8 User (org.example.app1.entities.User)4 Item (org.example.app2.entities.Item)4 CommitAfter (org.apache.tapestry5.hibernate.annotations.CommitAfter)3 User (org.example.app0.entities.User)3 User (org.example.app6.entities.User)3 ThingOne (org.apache.tapestry5.jpa.test.entities.ThingOne)2 Thang (org.example.app1.entities.Thang)2 Thing (org.example.app3.model.Thing)1 Thang (org.example.app6.entities.Thang)1