use of org.eclipse.persistence.dynamic.DynamicHelper in project eclipselink by eclipse-ee4j.
the class SimpleTypes_MultiTable method setUp.
@BeforeClass
public static void setUp() {
session = createSession();
dynamicHelper = new DynamicHelper(session);
DynamicClassLoader dcl = dynamicHelper.getDynamicClassLoader();
Class<?> simpleTypeA = dcl.createDynamicClass("simple.mappings.SimpleA");
DynamicTypeBuilder typeBuilder = new DynamicTypeBuilder(simpleTypeA, null, "SIMPLE_TYPE_A", "SIMPLE_TYPE_B", "SIMPLE_TYPE_C");
typeBuilder.setPrimaryKeyFields("SIMPLE_TYPE_A.SID");
typeBuilder.addDirectMapping("id", int.class, "SIMPLE_TYPE_A.SID");
typeBuilder.addDirectMapping("value1", String.class, "SIMPLE_TYPE_A.VAL_1");
typeBuilder.addDirectMapping("value2", boolean.class, "SIMPLE_TYPE_B.VAL_2");
typeBuilder.addDirectMapping("value3", String.class, "SIMPLE_TYPE_B.VAL_3");
typeBuilder.addDirectMapping("value4", double.class, "SIMPLE_TYPE_C.VAL_4");
typeBuilder.addDirectMapping("value5", String.class, "SIMPLE_TYPE_C.VAL_5");
dynamicHelper.addTypes(true, true, typeBuilder.getType());
}
use of org.eclipse.persistence.dynamic.DynamicHelper in project eclipselink by eclipse-ee4j.
the class SimpleTypes_OneToMany method setUp.
@BeforeClass
public static void setUp() {
session = createSession();
dynamicHelper = new DynamicHelper(session);
DynamicClassLoader dcl = dynamicHelper.getDynamicClassLoader();
// Create Dynamic Classes
Class<?> simpleTypeA = dcl.createDynamicClass("simple.mappings.SimpleA");
Class<?> simpleTypeB = dcl.createDynamicClass("simple.mappings.SimpleB");
// Build dynamic types with mappings
DynamicTypeBuilder aTypeBuilder = new DynamicTypeBuilder(simpleTypeA, null, "SIMPLE_TYPE_A");
aTypeBuilder.setPrimaryKeyFields("SID");
DynamicTypeBuilder bTypeBuilder = new DynamicTypeBuilder(simpleTypeB, null, "SIMPLE_TYPE_B");
bTypeBuilder.setPrimaryKeyFields("SID");
bTypeBuilder.addDirectMapping("id", int.class, "SID");
bTypeBuilder.addDirectMapping("value1", String.class, "VAL_1");
bTypeBuilder.addOneToOneMapping("a", aTypeBuilder.getType(), "A_FK");
aTypeBuilder.addDirectMapping("id", int.class, "SID");
aTypeBuilder.addDirectMapping("value1", String.class, "VAL_1");
aTypeBuilder.addOneToManyMapping("b", bTypeBuilder.getType(), "A_FK");
dynamicHelper.addTypes(true, true, aTypeBuilder.getType(), bTypeBuilder.getType());
}
use of org.eclipse.persistence.dynamic.DynamicHelper in project eclipselink by eclipse-ee4j.
the class SimpleTypes_AggregateObject method setUp.
@BeforeClass
public static void setUp() {
session = createSession();
dynamicHelper = new DynamicHelper(session);
DynamicClassLoader dcl = dynamicHelper.getDynamicClassLoader();
Class<?> simpleTypeB = dcl.createDynamicClass("simple.mappings.SimpleB");
DynamicTypeBuilder bTypeBuilder = new DynamicTypeBuilder(simpleTypeB, null);
bTypeBuilder.addDirectMapping("value2", boolean.class, "VAL_2");
bTypeBuilder.addDirectMapping("value3", String.class, "VAL_3");
Class<?> simpleTypeC = dcl.createDynamicClass("simple.mappings.SimpleC");
DynamicTypeBuilder cTypeBuilder = new DynamicTypeBuilder(simpleTypeC, null);
cTypeBuilder.addDirectMapping("value4", double.class, "VAL_4");
cTypeBuilder.addDirectMapping("value5", String.class, "VAL_5");
Class<?> simpleTypeA = dcl.createDynamicClass("simple.mappings.SimpleA");
DynamicTypeBuilder aTypeBuilder = new DynamicTypeBuilder(simpleTypeA, null, "SIMPLE_TYPE_A");
aTypeBuilder.setPrimaryKeyFields("SID");
aTypeBuilder.addDirectMapping("id", int.class, "SID");
aTypeBuilder.addDirectMapping("value1", String.class, "VAL_1");
aTypeBuilder.addAggregateObjectMapping("b", bTypeBuilder.getType(), true);
aTypeBuilder.addAggregateObjectMapping("c", cTypeBuilder.getType(), false);
dynamicHelper.addTypes(true, true, aTypeBuilder.getType(), bTypeBuilder.getType(), cTypeBuilder.getType());
}
use of org.eclipse.persistence.dynamic.DynamicHelper in project eclipselink by eclipse-ee4j.
the class ComicsPopulateAndQueryTestSuite method setUp.
@BeforeClass
public static void setUp() {
session = ComicsConfigTestSuite.buildComicsSession();
assertNotNull(session);
dynamicHelper = new DynamicHelper(session);
SchemaManager sm = new SchemaManager(session);
sm.replaceDefaultTables();
sm.replaceSequences();
}
use of org.eclipse.persistence.dynamic.DynamicHelper in project eclipselink by eclipse-ee4j.
the class SimpleTypeTestSuite method setUp.
@BeforeClass
public static void setUp() {
session = createSession();
dynamicHelper = new DynamicHelper(session);
DynamicClassLoader dcl = dynamicHelper.getDynamicClassLoader();
Class<?> javaType = dcl.createDynamicClass("simple.Simple");
DynamicTypeBuilder typeBuilder = new DynamicTypeBuilder(javaType, null, "SIMPLE_TYPE");
typeBuilder.setPrimaryKeyFields("SID");
typeBuilder.addDirectMapping("id", int.class, "SID");
typeBuilder.addDirectMapping("value1", String.class, "VAL_1");
typeBuilder.addDirectMapping("value2", boolean.class, "VAL_2");
typeBuilder.addDirectMapping("value3", Calendar.class, "VAL_3");
typeBuilder.addDirectMapping("value4", Character.class, "VAL_4");
dynamicHelper.addTypes(true, false, typeBuilder.getType());
}
Aggregations