Search in sources :

Example 1 with SchemaManager

use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.

the class EntityManagerSetupImpl method writeMetadataDDLToScript.

/**
 * INTERNAL:
 * Generate and write DDL from the persistence unit metadata to scripts.
 */
protected void writeMetadataDDLToScript(TableCreationType tableCreationType, Map props, DatabaseSessionImpl session, ClassLoader classLoader) {
    SchemaManager mgr = new SchemaManager(session);
    // Set the create database schemas flag on the schema manager.
    String createSchemas = getConfigPropertyAsString(SCHEMA_GENERATION_CREATE_DATABASE_SCHEMAS, props);
    mgr.setCreateDatabaseSchemas(createSchemas != null && createSchemas.equalsIgnoreCase("true"));
    writeDDLToFiles(mgr, getConfigPropertyAsString(PersistenceUnitProperties.APP_LOCATION, props), getConfigProperty(SCHEMA_GENERATION_SCRIPTS_CREATE_TARGET, props), getConfigProperty(SCHEMA_GENERATION_SCRIPTS_DROP_TARGET, props), tableCreationType, props);
}
Also used : SchemaManager(org.eclipse.persistence.tools.schemaframework.SchemaManager) EntityManagerFactoryProvider.getConfigPropertyAsString(org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.getConfigPropertyAsString)

Example 2 with SchemaManager

use of org.eclipse.persistence.tools.schemaframework.SchemaManager 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();
}
Also used : DynamicHelper(org.eclipse.persistence.dynamic.DynamicHelper) SchemaManager(org.eclipse.persistence.tools.schemaframework.SchemaManager) BeforeClass(org.junit.BeforeClass)

Example 3 with SchemaManager

use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.

the class InsuranceORStoredProcedureSystem method createTables.

/**
 * Also creates the procs.
 */
@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.isSQLServer()) {
    }
    if (platform.isSybase() || platform.isSQLAnywhere()) {
    }
    if (platform.isOracle()) {
        schema.replaceObject(buildOracleStoredProcedureInsertPolicyHolders());
        schema.replaceObject(buildOracleStoredProcedureReadFromPolicyHolders());
        schema.replaceObject(buildOracleStoredProcedureDeletePolicyHolders());
    }
    if (platform.isDB2()) {
    }
}
Also used : SchemaManager(org.eclipse.persistence.tools.schemaframework.SchemaManager)

Example 4 with SchemaManager

use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.

the class UOWSystem method createTables.

@Override
public void createTables(DatabaseSession session) {
    SchemaManager schemaManager = new SchemaManager(session);
    schemaManager.replaceObject(Contact.tableDefinition());
    schemaManager.replaceObject(Person.tableDefinition());
    schemaManager.replaceObject(MailAddress.tableDefinition());
    schemaManager.replaceObject(Weather.tableDefinition());
    schemaManager.replaceObject(ConcurrentAddress.tableDefinition());
    schemaManager.replaceObject(ConcurrentPerson.tableDefinition());
    schemaManager.replaceObject(ConcurrentProject.tableDefinition());
    schemaManager.replaceObject(ConcurrentPhoneNumber.tableDefinition());
    schemaManager.replaceObject(MutableAttributeObject.tableDefinition());
    schemaManager.createSequences();
}
Also used : SchemaManager(org.eclipse.persistence.tools.schemaframework.SchemaManager)

Example 5 with SchemaManager

use of org.eclipse.persistence.tools.schemaframework.SchemaManager in project eclipselink by eclipse-ee4j.

the class MapCollectionsSystem method createTables.

@Override
public void createTables(DatabaseSession session) {
    SchemaManager schemaManager = new SchemaManager(session);
    schemaManager.replaceObject(DirectEntityMapHolder.tableDefinition());
    schemaManager.replaceObject(DirectEntityMapHolder.relationTableDefinition());
    schemaManager.replaceObject(DirectEntity1MMapHolder.tableDefinition());
    schemaManager.replaceObject(EntityMapValue.tableDefinition());
    schemaManager.replaceObject(AggregateEntityMapHolder.tableDefinition());
    schemaManager.replaceObject(AggregateEntityMapHolder.relationTableDefinition());
    schemaManager.replaceObject(EntityEntityMapHolder.tableDefinition());
    schemaManager.replaceObject(EntityEntityMapHolder.relationTableDefinition());
    schemaManager.replaceObject(EntityMapKey.tableDefinition());
    schemaManager.replaceObject(DirectDirectMapHolder.tableDefinition());
    schemaManager.replaceObject(DirectDirectMapHolder.relationTableDefinition());
    schemaManager.replaceObject(AggregateDirectMapHolder.tableDefinition());
    schemaManager.replaceObject(AggregateDirectMapHolder.relationTableDefinition());
    schemaManager.replaceObject(EntityDirectMapHolder.tableDefinition());
    schemaManager.replaceObject(EntityDirectMapHolder.relationTableDefinition());
    schemaManager.replaceObject(AggregateAggregateMapHolder.tableDefinition());
    schemaManager.replaceObject(AggregateAggregateMapHolder.relationTableDefinition());
    schemaManager.replaceObject(DirectAggregateMapHolder.tableDefinition());
    schemaManager.replaceObject(DirectAggregateMapHolder.relationTableDefinition());
    schemaManager.replaceObject(EntityAggregateMapHolder.tableDefinition());
    schemaManager.replaceObject(EntityAggregateMapHolder.relationTableDefinition());
    schemaManager.replaceObject(DEOTMMapValue.tableDefinition());
    schemaManager.replaceObject(AggregateEntity1MMapHolder.tableDefinition());
    schemaManager.replaceObject(AEOTMMapValue.tableDefinition());
    schemaManager.replaceObject(EntityEntity1MMapHolder.tableDefinition());
    schemaManager.replaceObject(EEOTMMapValue.tableDefinition());
    schemaManager.replaceObject(DirectEntityU1MMapHolder.tableDefinition());
    schemaManager.replaceObject(AggregateEntityU1MMapHolder.tableDefinition());
    schemaManager.replaceObject(EntityEntityU1MMapHolder.tableDefinition());
    schemaManager.createSequences();
}
Also used : SchemaManager(org.eclipse.persistence.tools.schemaframework.SchemaManager)

Aggregations

SchemaManager (org.eclipse.persistence.tools.schemaframework.SchemaManager)40 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)17 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)9 Vector (java.util.Vector)4 DatabasePlatform (org.eclipse.persistence.internal.databaseaccess.DatabasePlatform)4 StoredProcedureDefinition (org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)4 EntityManager (jakarta.persistence.EntityManager)3 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)3 EntityManagerFactoryProvider.getConfigPropertyAsString (org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.getConfigPropertyAsString)3 DatabaseSessionImpl (org.eclipse.persistence.internal.sessions.DatabaseSessionImpl)3 DatabasePlatform (org.eclipse.persistence.platform.database.DatabasePlatform)3 SessionBroker (org.eclipse.persistence.sessions.broker.SessionBroker)3 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)3 DynamicClassLoader (org.eclipse.persistence.dynamic.DynamicClassLoader)2 DynamicEntity (org.eclipse.persistence.dynamic.DynamicEntity)2 DynamicHelper (org.eclipse.persistence.dynamic.DynamicHelper)2 DynamicType (org.eclipse.persistence.dynamic.DynamicType)2 Platform (org.eclipse.persistence.internal.databaseaccess.Platform)2 EntityManagerImpl (org.eclipse.persistence.internal.jpa.EntityManagerImpl)2 ManyToManyMapping (org.eclipse.persistence.mappings.ManyToManyMapping)2