Package com.force.sdk.jpa.entities

Examples of com.force.sdk.jpa.entities.ParentTestEntity


     */
    public void testBasicPersist() {
        txMgr = (PlatformTransactionManager) applicationContext.getBean("transactionManager");
        entity = new TestEntity();
        JPATestUtils.initializeTestEntity(entity);
        ParentTestEntity parent = JPATestUtils.setMasterDetailRelationship(entity);
        Assert.assertFalse(entityManager.contains(entity) || entityManager.contains(parent), "Entity is not transient.");
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
        TransactionStatus txStatus = txMgr.getTransaction(def);
        entityManager.persist(parent);
View Full Code Here


    public void testPersistenceContextRollback() {
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
        TransactionStatus txStatus = txMgr.getTransaction(def);
        TestEntity t = new TestEntity();
        ParentTestEntity p = JPATestUtils.setMasterDetailRelationship(t);
        Assert.assertFalse(entityManager.contains(t) || entityManager.contains(p), "Entities are not transient.");
        entityManager.persist(p);
        entityManager.persist(t);
        Assert.assertTrue(entityManager.contains(t) && entityManager.contains(p), "Entities are not managed.");
        txMgr.rollback(txStatus);
View Full Code Here

        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
        TransactionStatus txStatus = txMgr.getTransaction(def);
        TestEntity testEntity = new TestEntity();
        JPATestUtils.initializeNullTestEntity(testEntity);
        ParentTestEntity parent = new ParentTestEntity();
        parent.init();
        testEntity.setParentMasterDetail(parent);
        entityManager.persist(parent);
        entityManager.persist(testEntity);
        txMgr.commit(txStatus);
        Assert.assertNotNull(testEntity.getId(), testEntity.getClass().getName() + " ID was not generated.");
View Full Code Here

TOP

Related Classes of com.force.sdk.jpa.entities.ParentTestEntity

Copyright © 2018 www.massapicom. 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.