use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class MultisetFetchCollectionsBenchmarkTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
List<DocumentForCollections> docs = new ArrayList<>();
for (int i = 1; i <= 20; i++) {
docs.add(new DocumentForCollections("doc" + i));
}
DocumentForCollections doc1 = docs.get(0);
pers1 = new PersonForCollections("pers1");
for (DocumentForCollections doc : docs) {
doc.setOwner(pers1);
}
doc1.getPersonList().add(pers1);
for (int i = 2; i <= 20; i++) {
doc1.getPersonList().add(new PersonForCollections("listPers" + i));
}
doc1.getContacts().put(1, pers1);
for (int i = 2; i <= 20; i++) {
doc1.getContacts().put(i, new PersonForCollections("contactsPers" + i));
}
em.persist(pers1);
for (PersonForCollections personForCollections : doc1.getPersonList()) {
em.persist(personForCollections);
}
for (PersonForCollections personForCollections : doc1.getContacts().values()) {
em.persist(personForCollections);
}
for (DocumentForCollections doc : docs) {
em.persist(doc);
}
pers1.setPartnerDocument(doc1);
for (int i = 2; i <= 20; i++) {
PersonForCollections partner = new PersonForCollections("partnerPers" + i);
partner.setPartnerDocument(doc1);
em.persist(partner);
}
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class InheritanceMappingInAnotherEntityViewTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
B b = new B();
b.setSomeValue((short) 5);
b.setName("test1");
em.persist(b);
C c = new C();
c.setA(b);
c.setName("test");
em.persist(c);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class PolymorphicInheritanceTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
base1 = new SingleTableSub1("st1");
base2 = new SingleTableSub2("st2");
base1.setSub1Value(123);
base2.setSub2Value(456);
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 PolymorphicNestedInheritanceTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
base1 = new SingleTableSub1("st1");
base2 = new SingleTableSub2("st2");
base1.setSub1Value(123);
base2.setSub2Value(456);
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 AggregateViewPaginationTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
doc1 = new Document("doc1");
Person o1 = new Person("pers1", 10);
doc1.setAge(10);
doc1.setOwner(o1);
doc1.getContacts().put(1, o1);
doc1.getContacts2().put(2, o1);
em.persist(o1);
em.persist(doc1);
em.persist(new Document("doc2", o1));
}
});
}
Aggregations