use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class SubviewInheritanceTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Person o1 = new Person("pers1", 1);
Person o2 = new Person("pers2", 1);
Person o3 = new Person("pers3", 15);
Person o4 = new Person("pers4", 15);
Person o5 = new Person("pers5", 16);
Person o6 = new Person("pers6", 16);
doc1 = new Document("doc1", o1);
doc2 = new Document("doc2", o2);
doc3 = new Document("doc3", o3);
doc4 = new Document("doc4", o4);
doc5 = new Document("doc5", o5);
doc6 = new Document("doc6", o6);
em.persist(o1);
em.persist(o2);
em.persist(o3);
em.persist(o4);
em.persist(o5);
em.persist(o6);
em.persist(doc1);
em.persist(doc2);
em.persist(doc3);
em.persist(doc4);
em.persist(doc5);
em.persist(doc6);
o1.setFriend(o2);
o2.setPartnerDocument(doc1);
o3.setFriend(o4);
o4.setPartnerDocument(doc3);
o5.setFriend(o6);
o6.setPartnerDocument(doc5);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class MappingSubqueryTest method setUpOnce.
@Override
public void setUpOnce() {
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");
Person o3 = new Person("pers3");
o1.getLocalized().put(1, "localized1");
o2.getLocalized().put(1, "localized2");
o3.getLocalized().put(1, "localized3");
doc1.setAge(10);
doc1.setOwner(o1);
doc2.setAge(20);
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(o3);
// Flush doc1 before so we get the ids we would expect
em.persist(doc1);
em.flush();
em.persist(doc2);
em.flush();
o1.setPartnerDocument(doc1);
o2.setPartnerDocument(doc2);
o3.setPartnerDocument(doc2);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class JsonAndXmlTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Person p = new Person("Pers1");
p.setAge(20L);
em.persist(p);
Version v1 = new Version();
v1.setUrl("a");
Document doc1 = new Document("Doc1", p, v1);
em.persist(doc1);
em.persist(v1);
Version v2 = new Version();
v2.setUrl("b");
Document doc2 = new Document("Doc1", p, v2);
em.persist(doc2);
em.persist(v2);
Version v3 = new Version();
v3.setUrl("c");
Document doc3 = new Document("Doc2", p, v3);
em.persist(doc3);
em.persist(v3);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class KeysetPaginationNullsTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
KeysetEntity k01 = new KeysetEntity(1, null, null);
KeysetEntity k02 = new KeysetEntity(2, null, null);
KeysetEntity k03 = new KeysetEntity(3, 0, null);
KeysetEntity k04 = new KeysetEntity(4, 1, null);
KeysetEntity k05 = new KeysetEntity(5, 1, null);
KeysetEntity k06 = new KeysetEntity(6, 2, null);
KeysetEntity k07 = new KeysetEntity(7, null, 0);
KeysetEntity k08 = new KeysetEntity(8, null, 1);
KeysetEntity k09 = new KeysetEntity(9, null, 1);
KeysetEntity k10 = new KeysetEntity(10, null, 2);
KeysetEntity k11 = new KeysetEntity(11, 0, 0);
KeysetEntity k12 = new KeysetEntity(12, 0, 1);
KeysetEntity k13 = new KeysetEntity(13, 1, 0);
KeysetEntity k14 = new KeysetEntity(14, 1, 1);
KeysetEntity k15 = new KeysetEntity(15, 1, 1);
KeysetEntity k16 = new KeysetEntity(16, 1, 2);
KeysetEntity k17 = new KeysetEntity(17, 2, 1);
KeysetEntity k18 = new KeysetEntity(18, 2, 2);
em.persist(k01);
em.persist(k02);
em.persist(k03);
em.persist(k04);
em.persist(k05);
em.persist(k06);
em.persist(k07);
em.persist(k08);
em.persist(k09);
em.persist(k10);
em.persist(k11);
em.persist(k12);
em.persist(k13);
em.persist(k14);
em.persist(k15);
em.persist(k16);
em.persist(k17);
em.persist(k18);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class SubqueryTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Document doc1 = new Document("doc1");
Document doc2 = new Document("Doc2");
Document doc3 = new Document("doC3");
Document doc4 = new Document("dOc4");
Document doc5 = new Document("DOC5");
Document doc6 = new Document("bdoc");
Document doc7 = new Document("adoc");
Person o1 = new Person("Karl1");
Person o2 = new Person("Karl2");
o1.getLocalized().put(1, "abra kadabra");
o2.getLocalized().put(1, "ass");
doc1.setOwner(o1);
doc2.setOwner(o1);
doc3.setOwner(o1);
doc4.setOwner(o2);
doc5.setOwner(o2);
doc6.setOwner(o2);
doc7.setOwner(o2);
doc1.getContacts().put(1, o1);
doc1.getContacts().put(2, o2);
em.persist(o1);
em.persist(o2);
em.persist(doc1);
em.persist(doc2);
em.persist(doc3);
em.persist(doc4);
em.persist(doc5);
em.persist(doc6);
em.persist(doc7);
}
});
}
Aggregations