Examples of CustomDataRevEntity


Examples of org.hibernate.envers.test.entities.reventity.CustomDataRevEntity

        StrTestEntity te = new StrTestEntity("x");
        em.persist(te);
        id = te.getId();

    // Setting the data on the revision entity
    CustomDataRevEntity custom = getAuditReader().getCurrentRevision(CustomDataRevEntity.class, false);
    custom.setData("data1");

        em.getTransaction().commit();

        // Revision 2
        em.getTransaction().begin();
        te = em.find(StrTestEntity.class, id);
        te.setStr("y");

    // Setting the data on the revision entity
    custom = getAuditReader().getCurrentRevision(CustomDataRevEntity.class, false);
    custom.setData("data2");

        em.getTransaction().commit();

    // Revision 3 - no changes, but rev entity should be persisted
        em.getTransaction().begin();

    // Setting the data on the revision entity
    custom = getAuditReader().getCurrentRevision(CustomDataRevEntity.class, true);
    custom.setData("data3");

        em.getTransaction().commit();

    // No changes, rev entity won't be persisted
        em.getTransaction().begin();

    // Setting the data on the revision entity
    custom = getAuditReader().getCurrentRevision(CustomDataRevEntity.class, false);
    custom.setData("data4");

        em.getTransaction().commit();

    // Revision 4
        em.getTransaction().begin();
        te = em.find(StrTestEntity.class, id);
        te.setStr("z");

    // Setting the data on the revision entity
    custom = getAuditReader().getCurrentRevision(CustomDataRevEntity.class, false);
    custom.setData("data5");

    custom = getAuditReader().getCurrentRevision(CustomDataRevEntity.class, false);
    custom.setData("data5bis");

        em.getTransaction().commit();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.