Search in sources :

Example 1 with TPCSub2

use of com.blazebit.persistence.testsuite.entity.TPCSub2 in project blaze-persistence by Blazebit.

the class UpdatePolymorphicTest method setUp.

@Before
public void setUp() {
    cleanDatabase();
    transactional(new TxVoidWork() {

        @Override
        public void work(EntityManager em) {
            // Table per class data
            TPCSub1 tpc1 = new TPCSub1(1L, "TPC1");
            TPCSub2 tpc2 = new TPCSub2(2L, "TPC2");
            em.persist(tpc1);
            em.persist(tpc2);
            // Joined data
            PolymorphicSub1 joined1 = new PolymorphicSub1();
            PolymorphicSub2 joined2 = new PolymorphicSub2();
            joined1.setName("JOINED1");
            joined2.setName("JOINED2");
            em.persist(joined1);
            em.persist(joined2);
            // Single table data
            PolymorphicPropertySub1 st1 = new PolymorphicPropertySub1();
            PolymorphicPropertySub2 st2 = new PolymorphicPropertySub2();
            st1.setName("ST1");
            st2.setName("ST2");
            em.persist(st1);
            em.persist(st2);
        }
    });
}
Also used : EntityManager(javax.persistence.EntityManager) PolymorphicPropertySub1(com.blazebit.persistence.testsuite.entity.PolymorphicPropertySub1) PolymorphicPropertySub2(com.blazebit.persistence.testsuite.entity.PolymorphicPropertySub2) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) PolymorphicSub2(com.blazebit.persistence.testsuite.entity.PolymorphicSub2) PolymorphicSub1(com.blazebit.persistence.testsuite.entity.PolymorphicSub1) TPCSub1(com.blazebit.persistence.testsuite.entity.TPCSub1) TPCSub2(com.blazebit.persistence.testsuite.entity.TPCSub2) Before(org.junit.Before)

Example 2 with TPCSub2

use of com.blazebit.persistence.testsuite.entity.TPCSub2 in project blaze-persistence by Blazebit.

the class DeletePolymorphicTest method setUp.

@Before
public void setUp() {
    cleanDatabase();
    transactional(new TxVoidWork() {

        @Override
        public void work(EntityManager em) {
            // Table per class data
            tpc1 = new TPCSub1(1L, "TPC1");
            tpc2 = new TPCSub2(2L, "TPC2");
            em.persist(tpc1);
            em.persist(tpc2);
            // Joined data
            joined1 = new PolymorphicSub1();
            joined2 = new PolymorphicSub2();
            joined1.setName("JOINED1");
            joined2.setName("JOINED2");
            em.persist(joined1);
            em.persist(joined2);
            // Single table data
            st1 = new PolymorphicPropertySub1();
            st2 = new PolymorphicPropertySub2();
            st1.setName("ST1");
            st2.setName("ST2");
            em.persist(st1);
            em.persist(st2);
        }
    });
}
Also used : EntityManager(javax.persistence.EntityManager) PolymorphicPropertySub1(com.blazebit.persistence.testsuite.entity.PolymorphicPropertySub1) PolymorphicPropertySub2(com.blazebit.persistence.testsuite.entity.PolymorphicPropertySub2) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) PolymorphicSub2(com.blazebit.persistence.testsuite.entity.PolymorphicSub2) PolymorphicSub1(com.blazebit.persistence.testsuite.entity.PolymorphicSub1) TPCSub1(com.blazebit.persistence.testsuite.entity.TPCSub1) TPCSub2(com.blazebit.persistence.testsuite.entity.TPCSub2) Before(org.junit.Before)

Example 3 with TPCSub2

use of com.blazebit.persistence.testsuite.entity.TPCSub2 in project blaze-persistence by Blazebit.

the class TablePerClassTest method setUpOnce.

@Override
public void setUpOnce() {
    cleanDatabase();
    transactional(new TxVoidWork() {

        @Override
        public void work(EntityManager em) {
            TPCSub1 entity1 = new TPCSub1(1L, "test1");
            TPCSub2 entity2 = new TPCSub2(2L, "test2");
            em.persist(entity1);
            em.persist(entity2);
        }
    });
}
Also used : EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) TPCSub1(com.blazebit.persistence.testsuite.entity.TPCSub1) TPCSub2(com.blazebit.persistence.testsuite.entity.TPCSub2)

Example 4 with TPCSub2

use of com.blazebit.persistence.testsuite.entity.TPCSub2 in project blaze-persistence by Blazebit.

the class SelectPolymorphicTest method setUpOnce.

@Override
public void setUpOnce() {
    cleanDatabase();
    transactional(new TxVoidWork() {

        @Override
        public void work(EntityManager em) {
            TPCSub1 entity1 = new TPCSub1(1L, "test1");
            TPCSub2 entity2 = new TPCSub2(2L, "test2");
            em.persist(entity1);
            em.persist(entity2);
        }
    });
}
Also used : EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) TPCSub1(com.blazebit.persistence.testsuite.entity.TPCSub1) TPCSub2(com.blazebit.persistence.testsuite.entity.TPCSub2)

Aggregations

TPCSub1 (com.blazebit.persistence.testsuite.entity.TPCSub1)4 TPCSub2 (com.blazebit.persistence.testsuite.entity.TPCSub2)4 TxVoidWork (com.blazebit.persistence.testsuite.tx.TxVoidWork)4 EntityManager (javax.persistence.EntityManager)4 PolymorphicPropertySub1 (com.blazebit.persistence.testsuite.entity.PolymorphicPropertySub1)2 PolymorphicPropertySub2 (com.blazebit.persistence.testsuite.entity.PolymorphicPropertySub2)2 PolymorphicSub1 (com.blazebit.persistence.testsuite.entity.PolymorphicSub1)2 PolymorphicSub2 (com.blazebit.persistence.testsuite.entity.PolymorphicSub2)2 Before (org.junit.Before)2