use of org.eclipse.persistence.dynamic.DynamicClassLoader 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());
}
use of org.eclipse.persistence.dynamic.DynamicClassLoader in project eclipselink by eclipse-ee4j.
the class SimpleTypes_OneToOne method setUp.
@BeforeClass
public static void setUp() {
session = createSession();
// force logging level
session.setLogLevel(SessionLog.FINE);
dynamicHelper = new DynamicHelper(session);
DynamicClassLoader dcl = dynamicHelper.getDynamicClassLoader();
Class<?> simpleTypeB = dcl.createDynamicClass("simple.mappings.SimpleB");
DynamicTypeBuilder bFactory = new DynamicTypeBuilder(simpleTypeB, null, "SIMPLE_TYPE_B");
bFactory.setPrimaryKeyFields("SID");
bFactory.addDirectMapping("id", int.class, "SID");
bFactory.addDirectMapping("value1", String.class, "VAL_1");
Class<?> simpleTypeA = dcl.createDynamicClass("simple.mappings.SimpleA");
DynamicTypeBuilder aFactory = new DynamicTypeBuilder(simpleTypeA, null, "SIMPLE_TYPE_A");
aFactory.setPrimaryKeyFields("SID");
aFactory.addDirectMapping("id", int.class, "SID");
aFactory.addDirectMapping("value1", String.class, "VAL_1");
aFactory.addOneToOneMapping("b", bFactory.getType(), "B_FK");
dynamicHelper.addTypes(true, true, aFactory.getType(), bFactory.getType());
qTracker = QuerySQLTracker.install(session);
}
use of org.eclipse.persistence.dynamic.DynamicClassLoader in project eclipselink by eclipse-ee4j.
the class EmployeeProjectTestSuite method setUp.
@BeforeClass
public static void setUp() {
DynamicClassLoader dcl = new DynamicClassLoader(EmployeeProjectTestSuite.class.getClassLoader());
Project project = null;
try {
project = DynamicTypeBuilder.loadDynamicProject(PROJECT_XML, createLogin(), dcl);
} catch (IOException e) {
// e.printStackTrace();
fail("cannot find employee-project.xml");
}
session = project.createDatabaseSession();
if (SessionLog.OFF == logLevel) {
session.dontLogMessages();
} else {
session.setLogLevel(logLevel);
}
dynamicHelper = new DynamicHelper(session);
session.login();
new SchemaManager(session).replaceDefaultTables();
}
use of org.eclipse.persistence.dynamic.DynamicClassLoader in project eclipselink by eclipse-ee4j.
the class InvalidConfig method invalidResource.
@Test(expected = XMLMarshalException.class)
public void invalidResource() throws Exception {
DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(InvalidConfig.class.getClassLoader());
InputStream is = dynamicClassLoader.getResourceAsStream(INVALID_PROJECT_XML);
DynamicTypeBuilder.loadDynamicProject(is, new DatabaseLogin(), dynamicClassLoader);
}
use of org.eclipse.persistence.dynamic.DynamicClassLoader in project eclipselink by eclipse-ee4j.
the class SimpleMapProject method setUp.
@BeforeClass
public static void setUp() {
DynamicClassLoader dcl = new DynamicClassLoader(SimpleMapProject.class.getClassLoader());
Project project = null;
try {
project = DynamicTypeBuilder.loadDynamicProject(PROJECT_XML, createLogin(), dcl);
} catch (IOException e) {
// e.printStackTrace();
fail("cannot find simple-map-project.xml");
}
session = project.createDatabaseSession();
if (SessionLog.OFF == logLevel) {
session.dontLogMessages();
} else {
session.setLogLevel(logLevel);
}
dynamicHelper = new DynamicHelper(session);
session.login();
new DynamicSchemaManager(session).createTables();
}
Aggregations