Search in sources :

Example 11 with TxVoidWork

use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.

the class AttributeFilterTest method setUpOnce.

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

        @Override
        public void work(EntityManager em) {
            doc1 = new PrimitiveDocument("doc1");
            doc2 = new PrimitiveDocument("doc2");
            PrimitivePerson o1 = new PrimitivePerson("James");
            PrimitivePerson o2 = new PrimitivePerson("Jack");
            o1.setPartnerDocument(doc1);
            o2.setPartnerDocument(doc2);
            doc1.setOwner(o1);
            doc2.setOwner(o2);
            doc1.getContacts().put(1, o1);
            doc2.getContacts().put(1, o2);
            em.persist(o1);
            em.persist(o2);
            em.persist(doc1);
            em.persist(doc2);
        }
    });
}
Also used : PrimitiveDocument(com.blazebit.persistence.testsuite.entity.PrimitiveDocument) EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) PrimitivePerson(com.blazebit.persistence.testsuite.entity.PrimitivePerson)

Example 12 with TxVoidWork

use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.

the class AttributeFilterTest method setUpOnce.

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

        @Override
        public void work(EntityManager em) {
            doc1 = new PrimitiveDocument("doc1");
            doc2 = new PrimitiveDocument("doc2");
            PrimitivePerson o1 = new PrimitivePerson("James");
            PrimitivePerson o2 = new PrimitivePerson("Jack");
            o1.setPartnerDocument(doc1);
            o2.setPartnerDocument(doc2);
            doc1.setOwner(o1);
            doc2.setOwner(o2);
            doc1.getContacts().put(1, o1);
            doc2.getContacts().put(1, o2);
            em.persist(o1);
            em.persist(o2);
            em.persist(doc1);
            em.persist(doc2);
        }
    });
}
Also used : PrimitiveDocument(com.blazebit.persistence.testsuite.entity.PrimitiveDocument) EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) PrimitivePerson(com.blazebit.persistence.testsuite.entity.PrimitivePerson)

Example 13 with TxVoidWork

use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.

the class ConstructorOnlyFlatViewTest method setUp.

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

        @Override
        public void work(EntityManager em) {
            Document doc1 = new Document("doc1");
            Document doc2 = new Document("doc2");
            Person o1 = new Person("pers1");
            doc1.setOwner(o1);
            doc2.setOwner(o1);
            em.persist(o1);
            em.persist(doc1);
            em.persist(doc2);
        }
    });
}
Also used : EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) Document(com.blazebit.persistence.testsuite.entity.Document) Person(com.blazebit.persistence.testsuite.entity.Person) Before(org.junit.Before)

Example 14 with TxVoidWork

use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.

the class AbstractFetchTest method setUpOnce.

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

        @Override
        public void work(EntityManager em) {
            doc1 = new Document("doc1");
            doc2 = new Document("doc2");
            doc3 = new Document("doc3");
            doc4 = new Document("doc4");
            Person o1 = new Person("pers1");
            Person o2 = new Person("pers2");
            Person o3 = new Person("pers3");
            doc1.setOwner(o1);
            doc2.setOwner(o2);
            doc3.setOwner(o2);
            doc4.setOwner(o2);
            doc1.getStrings().add("s1");
            doc1.getStrings().add("s2");
            doc2.getStrings().add("s1");
            doc2.getStrings().add("s2");
            doc3.getStrings().add("s1");
            doc3.getStrings().add("s2");
            doc4.getStrings().add("s1");
            doc4.getStrings().add("s2");
            em.persist(o1);
            em.persist(o2);
            em.persist(o3);
            em.persist(doc1);
            em.persist(doc2);
            em.persist(doc3);
            em.persist(doc4);
            o1.setPartnerDocument(doc1);
            o2.setPartnerDocument(doc2);
            o3.setPartnerDocument(doc3);
        }
    });
}
Also used : EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) Document(com.blazebit.persistence.testsuite.entity.Document) Person(com.blazebit.persistence.testsuite.entity.Person)

Example 15 with TxVoidWork

use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.

the class PrimitiveViewTest method setUp.

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

        @Override
        public void work(EntityManager em) {
            doc1 = new PrimitiveDocument("doc1");
            doc2 = new PrimitiveDocument("doc2");
            o1 = new PrimitivePerson("pers1");
            o2 = new PrimitivePerson("pers2");
            o1.setPartnerDocument(doc1);
            o2.setPartnerDocument(doc2);
            doc1.setOwner(o1);
            doc2.setOwner(o2);
            doc1.getContacts().put(1, o1);
            doc2.getContacts().put(1, o2);
            em.persist(o1);
            em.persist(o2);
            em.persist(doc1);
            em.persist(doc2);
        }
    });
    doc1 = em.find(PrimitiveDocument.class, doc1.getId());
    doc2 = em.find(PrimitiveDocument.class, doc2.getId());
}
Also used : PrimitiveDocument(com.blazebit.persistence.testsuite.entity.PrimitiveDocument) EntityManager(javax.persistence.EntityManager) TxVoidWork(com.blazebit.persistence.testsuite.tx.TxVoidWork) PrimitivePerson(com.blazebit.persistence.testsuite.entity.PrimitivePerson) Before(org.junit.Before)

Aggregations

TxVoidWork (com.blazebit.persistence.testsuite.tx.TxVoidWork)135 EntityManager (javax.persistence.EntityManager)131 Person (com.blazebit.persistence.testsuite.entity.Person)76 Document (com.blazebit.persistence.testsuite.entity.Document)69 Before (org.junit.Before)28 Test (org.junit.Test)15 Version (com.blazebit.persistence.testsuite.entity.Version)14 DocumentForCollections (com.blazebit.persistence.view.testsuite.collections.entity.simple.DocumentForCollections)11 PersonForCollections (com.blazebit.persistence.view.testsuite.collections.entity.simple.PersonForCollections)11 Category (org.junit.experimental.categories.Category)7 IntIdEntity (com.blazebit.persistence.testsuite.entity.IntIdEntity)5 SingleTableSub1 (com.blazebit.persistence.testsuite.treat.entity.SingleTableSub1)5 SingleTableSub2 (com.blazebit.persistence.testsuite.treat.entity.SingleTableSub2)5 PolymorphicSub1 (com.blazebit.persistence.testsuite.entity.PolymorphicSub1)4 PolymorphicSub2 (com.blazebit.persistence.testsuite.entity.PolymorphicSub2)4 TPCSub1 (com.blazebit.persistence.testsuite.entity.TPCSub1)4 TPCSub2 (com.blazebit.persistence.testsuite.entity.TPCSub2)4 CriteriaBuilder (com.blazebit.persistence.CriteriaBuilder)3 EmbeddableTestEntity (com.blazebit.persistence.testsuite.entity.EmbeddableTestEntity)3 EmbeddableTestEntityId (com.blazebit.persistence.testsuite.entity.EmbeddableTestEntityId)3