use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.
the class JUnitJPQLComplexTestSuite method testSetup.
/**
* The setup is done as a test, both to record its failure, and to allow execution in the server.
*/
public void testSetup() {
clearCache();
// get session to start setup
DatabaseSession session = JUnitTestCase.getServerSession();
// create a new EmployeePopulator
EmployeePopulator employeePopulator = new EmployeePopulator();
// create a new PartnerLinkPopulator
PartnerLinkPopulator partnerLinkPopulator = new PartnerLinkPopulator();
new AdvancedTableCreator().replaceTables(session);
// initialize the global comparer object
comparer = new JUnitDomainObjectComparer();
// set the session for the comparer to use
comparer.setSession((AbstractSession) session.getActiveSession());
// Populate the tables
employeePopulator.buildExamples();
// Persist the examples in the database
employeePopulator.persistExample(session);
// Populate the tables
partnerLinkPopulator.buildExamples();
// Persist the examples in the database
partnerLinkPopulator.persistExample(session);
new InheritedTableManager().replaceTables(session);
new DataTypesTableCreator().replaceTables(session);
// create stored function when database supports it
if (supportsStoredFunctions()) {
SchemaManager schema = new SchemaManager(session);
schema.replaceObject(buildStoredFunction());
}
new CompositePKTableCreator().replaceTables(JUnitTestCase.getServerSession());
}
use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.
the class OracleTIMESTAMPTypeTestSystem method createTables.
@Override
public void createTables(DatabaseSession session) {
SchemaManager schemaManager = new SchemaManager(session);
if (session.getPlatform() instanceof Oracle9Platform) {
schemaManager.replaceObject(TIMESTAMPDirectToFieldTester.tableDefinition(session));
schemaManager.replaceObject(TIMESTAMPTypeConversionTester.tableDefinition(session));
schemaManager.replaceObject(CalendarToTSTZWithoutSessionTZTest.tableDefinition(session));
schemaManager.replaceObject(TIMESTAMPTZOwner.tableDefinition());
schemaManager.replaceObject(CalendarToTSTZWithBindingTest.tableDefinition());
schemaManager.replaceObject(CalendarDaylightSavingsTest.tableDefinition());
}
}
use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.
the class EmployeePopulator method persistExample.
public void persistExample(Session session) {
Vector allObjects = new Vector();
UnitOfWork unitOfWork = session.acquireUnitOfWork();
// Disable the read-only classes for model population. Specifically,
// in this case we want to be able to create EquipmentCode objects.
unitOfWork.removeAllReadOnlyClasses();
PopulationManager.getDefaultManager().addAllObjectsForClass(Employee.class, allObjects);
PopulationManager.getDefaultManager().addAllObjectsForClass(SmallProject.class, allObjects);
PopulationManager.getDefaultManager().addAllObjectsForClass(LargeProject.class, allObjects);
PopulationManager.getDefaultManager().addAllObjectsForClass(GoldBuyer.class, allObjects);
PopulationManager.getDefaultManager().addAllObjectsForClass(PlatinumBuyer.class, allObjects);
PopulationManager.getDefaultManager().addAllObjectsForClass(EquipmentCode.class, allObjects);
unitOfWork.registerAllObjects(allObjects);
unitOfWork.commit();
if (TestCase.supportsStoredProcedures(session)) {
SchemaManager schema = new SchemaManager((DatabaseSession) session);
schema.replaceObject(buildOracleStoredProcedureReadFromAddress((DatabaseSession) session));
schema.replaceObject(buildOracleStoredProcedureReadInOut((DatabaseSession) session));
}
// Force uppercase for Postgres.
if (session.getPlatform().isPostgreSQL()) {
session.getLogin().setShouldForceFieldNamesToUpperCase(true);
}
}
use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.
the class EntityTypeFromDescriptor method entityTypeFromDescriptor.
@Test
public void entityTypeFromDescriptor() throws Exception {
DatabaseSession session = createSession();
session.login();
DynamicClassLoader dcl = DynamicClassLoader.lookup(session);
ClassDescriptor descriptor = buildMyEntityDescriptor();
assertFalse(descriptor.isAggregateDescriptor());
DynamicType entityType = new DynamicTypeBuilder(dcl, descriptor, null).getType();
MyEntity.DPM.setType(entityType);
assertFalse(descriptor.isAggregateDescriptor());
assertEquals(MyEntity.class, entityType.getJavaClass());
session.addDescriptor(entityType.getDescriptor());
new SchemaManager(session).replaceDefaultTables();
DynamicEntity entity = entityType.newDynamicEntity();
entity.set("id", 1);
entity.set("name", "Name");
session.insertObject(entity);
session.logout();
}
use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.
the class EmployeeCustomSQLMWIntegrationSystem method createTables.
// build your owner stored procedure rather than those inherited if necessary.
// schema.replaceObject(buildOracleStoredProcedureForProjectXML());
@Override
public void createTables(DatabaseSession session) {
super.createTables(session);
org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform = session.getLogin().getPlatform();
SchemaManager schema = new SchemaManager((session));
if (platform.isOracle()) {
}
}
Aggregations