use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class CustomClassViewTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
doc1 = new Document("doc1", 5L);
doc2 = new Document("doc2", 10L);
Person o1 = new Person("pers1");
Person o2 = new Person("pers2");
o1.getLocalized().put(1, "localized1");
o2.getLocalized().put(1, "localized2");
o1.setPartnerDocument(doc1);
o2.setPartnerDocument(doc2);
doc1.setOwner(o1);
doc2.setOwner(o2);
doc1.getContacts().put(1, o1);
doc2.getContacts().put(1, o2);
doc1.getContacts2().put(2, o1);
doc2.getContacts2().put(2, o2);
em.persist(o1);
em.persist(o2);
em.persist(doc1);
em.persist(doc2);
}
});
doc1 = em.find(Document.class, doc1.getId());
doc2 = em.find(Document.class, doc2.getId());
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class EmbeddedInheritanceTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
IntIdEntity i1 = new IntIdEntity("i1", 1);
base1 = new SingleTableSub1("st1");
base2 = new SingleTableSub2("st2");
base1.setSub1Value(123);
base2.setSub2Value(456);
base2.setRelation2(i1);
em.persist(i1);
em.persist(base1);
em.persist(base2);
base1.setParent(base2);
base2.setParent(base1);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class FlatViewPaginationTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
for (int i = 1; i <= 10; i++) {
Person person = new Person("pers" + i);
em.persist(person);
}
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class FlatViewTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
doc1 = new Document("doc1");
doc2 = new Document("doc2");
Person o1 = new Person("pers1");
Person o2 = new Person("pers2");
o1.getLocalized().put(1, "localized1");
o2.getLocalized().put(1, "localized2");
o1.setPartnerDocument(doc1);
o2.setPartnerDocument(doc2);
doc1.setOwner(o1);
doc2.setOwner(o2);
doc1.getContacts().put(1, o1);
doc2.getContacts().put(1, o2);
doc1.getContacts2().put(2, o1);
doc2.getContacts2().put(2, o2);
em.persist(o1);
em.persist(o2);
em.persist(doc1);
em.persist(doc2);
}
});
doc1 = cbf.create(em, Document.class).where("id").eq(doc1.getId()).fetch("owner").getSingleResult();
doc2 = cbf.create(em, Document.class).where("id").eq(doc2.getId()).fetch("owner").getSingleResult();
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class UpdatableFlatViewTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
doc1 = new Document("doc1");
Person o1 = new Person("pers1");
doc1.setOwner(o1);
doc1.getNameMap().put("doc1", new NameObject("doc1", "doc1"));
doc1.getNameMap().put("doc2", new NameObject("doc1", "doc1"));
em.persist(o1);
em.persist(doc1);
}
});
doc1 = cbf.create(em, Document.class).where("id").eq(doc1.getId()).fetch("owner").getSingleResult();
}
Aggregations