use of com.blazebit.persistence.testsuite.treat.entity.SingleTableSub2 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.treat.entity.SingleTableSub2 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.treat.entity.SingleTableSub2 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.treat.entity.SingleTableSub2 in project blaze-persistence by Blazebit.
the class AbstractTreatVariationsTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
IntIdEntity i1 = new IntIdEntity("i1", 1);
em.persist(i1);
persist(em, new IntIdEntity("s1", 1));
persist(em, new IntIdEntity("s2", 2));
persist(em, new IntIdEntity("s1.parent", 101));
persist(em, new IntIdEntity("s2.parent", 102));
persist(em, new IntIdEntity("st1", 1));
persist(em, new IntIdEntity("st2", 2));
persist(em, new IntIdEntity("st1.parent", 101));
persist(em, new IntIdEntity("st2.parent", 102));
persist(em, new IntIdEntity("tpc1", 1));
persist(em, new IntIdEntity("tpc2", 2));
persist(em, new IntIdEntity("tpc1.parent", 101));
persist(em, new IntIdEntity("tpc2.parent", 102));
/**
**************
* Joined
**************
*/
JoinedSub1 s1 = new JoinedSub1("s1");
JoinedSub2 s2 = new JoinedSub2("s2");
JoinedSub1 s1Parent = new JoinedSub1("s1.parent");
JoinedSub2 s2Parent = new JoinedSub2("s2.parent");
persist(em, i1, s1, s2, s1Parent, s2Parent);
/**
**************
* Single Table
**************
*/
SingleTableSub1 st1 = new SingleTableSub1("st1");
SingleTableSub2 st2 = new SingleTableSub2("st2");
SingleTableSub1 st1Parent = new SingleTableSub1("st1.parent");
SingleTableSub2 st2Parent = new SingleTableSub2("st2.parent");
persist(em, i1, st1, st2, st1Parent, st2Parent);
/**
**************
* Table per Class
**************
*/
TablePerClassSub1 tpc1 = new TablePerClassSub1(1L, "tpc1");
TablePerClassSub2 tpc2 = new TablePerClassSub2(2L, "tpc2");
TablePerClassSub1 tpc1Parent = new TablePerClassSub1(3L, "tpc1.parent");
TablePerClassSub2 tpc2Parent = new TablePerClassSub2(4L, "tpc2.parent");
// The Java compiler can't up-cast automatically, maybe a bug?
// persist(em, i1, tpc1, tpc2, tpc1Parent, tpc2Parent);
persist(em, i1, (Sub1) tpc1, (Sub2) tpc2, (Sub1) tpc1Parent, (Sub2) tpc2Parent);
}
});
}
use of com.blazebit.persistence.testsuite.treat.entity.SingleTableSub2 in project blaze-persistence by Blazebit.
the class AbstractTreatVariationsTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
IntIdEntity i1 = new IntIdEntity("i1", 1);
em.persist(i1);
persist(em, new IntIdEntity("s1", 1));
persist(em, new IntIdEntity("s2", 2));
persist(em, new IntIdEntity("s1.parent", 101));
persist(em, new IntIdEntity("s2.parent", 102));
persist(em, new IntIdEntity("st1", 1));
persist(em, new IntIdEntity("st2", 2));
persist(em, new IntIdEntity("st1.parent", 101));
persist(em, new IntIdEntity("st2.parent", 102));
persist(em, new IntIdEntity("tpc1", 1));
persist(em, new IntIdEntity("tpc2", 2));
persist(em, new IntIdEntity("tpc1.parent", 101));
persist(em, new IntIdEntity("tpc2.parent", 102));
/**
**************
* Joined
**************
*/
JoinedSub1 s1 = new JoinedSub1("s1");
JoinedSub2 s2 = new JoinedSub2("s2");
JoinedSub1 s1Parent = new JoinedSub1("s1.parent");
JoinedSub2 s2Parent = new JoinedSub2("s2.parent");
if (supportsJoinedInheritance()) {
persist(em, i1, s1, s2, s1Parent, s2Parent);
}
/**
**************
* Single Table
**************
*/
SingleTableSub1 st1 = new SingleTableSub1("st1");
SingleTableSub2 st2 = new SingleTableSub2("st2");
SingleTableSub1 st1Parent = new SingleTableSub1("st1.parent");
SingleTableSub2 st2Parent = new SingleTableSub2("st2.parent");
persist(em, i1, st1, st2, st1Parent, st2Parent);
/**
**************
* Table per Class
**************
*/
TablePerClassSub1 tpc1 = new TablePerClassSub1(1L, "tpc1");
TablePerClassSub2 tpc2 = new TablePerClassSub2(2L, "tpc2");
TablePerClassSub1 tpc1Parent = new TablePerClassSub1(3L, "tpc1.parent");
TablePerClassSub2 tpc2Parent = new TablePerClassSub2(4L, "tpc2.parent");
// persist(em, i1, tpc1, tpc2, tpc1Parent, tpc2Parent);
if (supportsTablePerClassInheritance()) {
persist(em, i1, (Sub1) tpc1, (Sub2) tpc2, (Sub1) tpc1Parent, (Sub2) tpc2Parent);
}
}
});
}
Aggregations