aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Jungmann2014-05-02 10:07:01 (EDT)
committerTomas Kraus2014-05-05 05:21:46 (EDT)
commit1673abb10758122f3c61c2c586d6212b6fdd5ad0 (patch)
tree0033aed3b4d9f9f97f33742b5ab40bbb2e15f528
parent4567e7e5228ba1dfb851167f80d9ec577c594d39 (diff)
downloadeclipselink.runtime-1673abb10758122f3c61c2c586d6212b6fdd5ad0.zip
eclipselink.runtime-1673abb10758122f3c61c2c586d6212b6fdd5ad0.tar.gz
eclipselink.runtime-1673abb10758122f3c61c2c586d6212b6fdd5ad0.tar.bz2
Bug #434080: remove some noise when running tests on MySQL (drop constraint is drop foreign key there)
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com> add clear-database target to eclipselink.jpa.test project Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
-rw-r--r--foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/inheritance/InheritanceSystem.java503
-rw-r--r--foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/ownership/OwnershipSystem.java187
-rw-r--r--jpa/eclipselink.jpa.test/antbuild.xml13
-rw-r--r--jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/CompositePKTableCreator.java2305
-rw-r--r--jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inheritance/InheritanceTableCreator.java4608
-rw-r--r--jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/orphanremoval/OrphanRemovalModelTableCreator.java761
-rw-r--r--jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/privateowned/PrivateOwnedModelTableCreator.java933
7 files changed, 4682 insertions, 4628 deletions
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/inheritance/InheritanceSystem.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/inheritance/InheritanceSystem.java
index 30c73ba..5cb95bf 100644
--- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/inheritance/InheritanceSystem.java
+++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/inheritance/InheritanceSystem.java
@@ -1,247 +1,256 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.testing.models.inheritance;
-
-import java.util.*;
-import org.eclipse.persistence.internal.databaseaccess.*;
-import org.eclipse.persistence.sessions.*;
-import org.eclipse.persistence.annotations.IdValidation;
-import org.eclipse.persistence.descriptors.*;
-import org.eclipse.persistence.queries.*;
-import org.eclipse.persistence.sessions.factories.*;
-import org.eclipse.persistence.testing.framework.*;
-import org.eclipse.persistence.tools.schemaframework.*;
-
-public class InheritanceSystem extends TestSystem {
- public InheritanceSystem() {
- project = XMLProjectReader.read("org/eclipse/persistence/testing/models/inheritance/inheritance-project.xml", getClass().getClassLoader());
- }
-
- public void addDescriptors(DatabaseSession session) {
- // Oracle has bug in outjoins that require outerjoin of inheritance type.
- // This should really be handled by the platform during expression normalization...
- // Id for Entomologist can be negative (millis cast to int wraps...)
- project.getDescriptor(Entomologist.class).setIdValidation(IdValidation.NONE);
-
- session.addDescriptors(project);
-
- // For using read all subclasses views.
- DatabasePlatform platform = session.getLogin().getPlatform();
- if (platform.isOracle() || platform.isSybase()) {
- ClassDescriptor computerDescriptor = session.getDescriptor(Computer.class);
- ClassDescriptor vehicleDescriptor = session.getDescriptor(Vehicle.class);
- computerDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllComputers");
- vehicleDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllVehicles");
- }
-
- // Enable outer-join on AnimalMatt hierarchy.
- session.getDescriptor(Animal_Matt.class).getInheritancePolicy().setShouldOuterJoinSubclasses(true);
- }
-
- public void createTables(DatabaseSession session) {
- dropTableConstraints(session);
- new InheritanceTableCreator().replaceTables(session);
-
- SchemaManager schemaManager = new SchemaManager(session);
- if (session.getLogin().getPlatform().isOracle()) {
- schemaManager.replaceObject(Computer.oracleView());
- schemaManager.replaceObject(Vehicle.oracleView());
- } else if (session.getLogin().getPlatform().isSybase()) {
- schemaManager.replaceObject(Computer.sybaseView());
- schemaManager.replaceObject(Vehicle.sybaseView());
- //CREATE VIEW statement was added in MySQL 5.0.1. Uncomment it when we support MySQL 5
- //} else if (session.getLogin().getPlatform().isMySQL()) {
- //schemaManager.replaceObject(Computer.sybaseView());
- //schemaManager.replaceObject(Vehicle.mySQLView());
- }
- }
-
- /**
- * Drop table constraints
- */
- public void dropTableConstraints(Session session) {
- if (!SchemaManager.FAST_TABLE_CREATOR) {
- if (session.getLogin().getPlatform().isOracle()) {
- try {
- session.executeNonSelectingCall(new SQLCall("drop table BUS CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table CAR CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table COMPANY CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table FUEL_VEH CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table NH_COMP CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table INH_MF CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table KING_DEVELOPER CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table KING_PERSONG CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table PARTNUMS CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
-
- try {
- session.executeNonSelectingCall(new SQLCall("drop table VEHICLE CASCADE CONSTRAINTS"));
- } catch (Exception e) {}
- }
-
- // Drop old constraints.
- try {
- if (session.getPlatform().supportsUniqueKeyConstraints()
- && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
- session.executeNonSelectingSQL("Alter TABLE PROJECT_WORKER_BATCH DROP CONSTRAINT PROJECT_WORKER_BATCH_HD");
- session.executeNonSelectingSQL("Alter TABLE PROJECT_BATCH DROP CONSTRAINT PROJECT_WORKER_BATCH_FK");
- session.executeNonSelectingSQL("Alter TABLE ALLIGATOR DROP CONSTRAINT FK_ALLIGATOR_VICTIM_ID");
- session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP CONSTRAINT PERSON2_PERSON2_FRND");
- session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP CONSTRAINT PERSON2_PERSON2_REP");
- session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP CONSTRAINT PERSON2_PERSON2_BS");
- }
- } catch (Exception ignore) {}
- }
- }
-
- public void populate(DatabaseSession session) {
- PopulationManager manager = PopulationManager.getDefaultManager();
-
- Cat cat = Cat.example1();
- session.writeObject(cat);
- manager.registerObject(cat, "catExample1");
-
- Dog dog = Dog.example1();
- session.writeObject(dog);
- manager.registerObject(dog, "dogExample1");
-
- cat = Cat.example2();
- session.writeObject(cat);
- manager.registerObject(cat, "catExample2");
-
- dog = Dog.example2();
- session.writeObject(dog);
- manager.registerObject(dog, "dogExample2");
-
- cat = Cat.example3();
- session.writeObject(cat);
- manager.registerObject(cat, "catExample3");
-
- dog = Dog.example3();
- session.writeObject(dog);
- manager.registerObject(dog, "dogExample3");
-
- Company company = Company.example1();
- session.writeObject(company);
- manager.registerObject(company, "example1");
-
- manager.registerObject(((Vector)company.getVehicles().getValue()).firstElement(), "example1");
-
- company = Company.example2();
- session.writeObject(company);
- manager.registerObject(company, "example2");
-
- company = Company.example3();
- session.writeObject(company);
- manager.registerObject(company, "example3");
-
- Person person = Person.example1();
- session.writeObject(person);
- manager.registerObject(person, "example1");
-
- //populate the data for duplicate field testing
- session.writeObject(A_King2.exp1());
- session.writeObject(A_King2.exp2());
- session.writeObject(A_1_King2.exp3());
- session.writeObject(A_2_King2.exp4());
- session.writeObject(A_2_1_King2.exp5());
-
- UnitOfWork unitOfWork = session.acquireUnitOfWork();
- person = Person.example2();
- unitOfWork.registerObject(person);
- unitOfWork.commit();
- manager.registerObject(person, "example2");
- manager.registerObject(person.bestFriend, "example5");
- manager.registerObject(person.representitive, "example4");
-
- person = Person.example3();
- session.writeObject(person);
- manager.registerObject(person, "example3");
-
- Computer computer = Computer.example1();
- session.writeObject(computer);
- manager.registerObject(computer, "example1");
-
- computer = Computer.example2();
- session.writeObject(computer);
- manager.registerObject(computer, "example2");
-
- computer = Computer.example3();
- session.writeObject(computer);
- manager.registerObject(computer, "example3");
-
- computer = Computer.example4();
- session.writeObject(computer);
- manager.registerObject(computer, "example4");
-
- computer = Computer.example5();
- session.writeObject(computer);
- manager.registerObject(computer, "example5");
-
- JavaProgrammer JP = JavaProgrammer.example1();
- session.writeObject(JP);
- manager.registerObject(JP, "example1");
-
- JP = JavaProgrammer.example2();
- session.writeObject(JP);
- manager.registerObject(JP, "example2");
-
- // Added to test bug 3019934.
- unitOfWork = session.acquireUnitOfWork();
- Alligator alligator = new Alligator();
- alligator.setFavoriteSwamp("Florida");
- alligator.setLatestVictim(JavaProgrammer.steve());
- unitOfWork.registerObject(alligator);
- manager.registerObject(alligator, "example1");
- unitOfWork.commit();
-
- //Added to test bug 6111278
-
- unitOfWork = session.acquireUnitOfWork();
- Entomologist bugguy = new Entomologist();
- bugguy.setId((int)System.currentTimeMillis());
- bugguy.setName("Gary");
- bugguy = (Entomologist)unitOfWork.registerObject(bugguy);
- GrassHopper insect = new GrassHopper();
- insect.setIn_numberOfLegs(4);
- insect.setGh_maximumJump(5);
- insect.setEntomologist(bugguy);
- bugguy.getInsectCollection().add(insect);
- unitOfWork.commit();
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.inheritance;
+
+import java.util.*;
+import org.eclipse.persistence.internal.databaseaccess.*;
+import org.eclipse.persistence.sessions.*;
+import org.eclipse.persistence.annotations.IdValidation;
+import org.eclipse.persistence.descriptors.*;
+import org.eclipse.persistence.queries.*;
+import org.eclipse.persistence.sessions.factories.*;
+import org.eclipse.persistence.testing.framework.*;
+import org.eclipse.persistence.tools.schemaframework.*;
+
+public class InheritanceSystem extends TestSystem {
+ public InheritanceSystem() {
+ project = XMLProjectReader.read("org/eclipse/persistence/testing/models/inheritance/inheritance-project.xml", getClass().getClassLoader());
+ }
+
+ public void addDescriptors(DatabaseSession session) {
+ // Oracle has bug in outjoins that require outerjoin of inheritance type.
+ // This should really be handled by the platform during expression normalization...
+ // Id for Entomologist can be negative (millis cast to int wraps...)
+ project.getDescriptor(Entomologist.class).setIdValidation(IdValidation.NONE);
+
+ session.addDescriptors(project);
+
+ // For using read all subclasses views.
+ DatabasePlatform platform = session.getLogin().getPlatform();
+ if (platform.isOracle() || platform.isSybase()) {
+ ClassDescriptor computerDescriptor = session.getDescriptor(Computer.class);
+ ClassDescriptor vehicleDescriptor = session.getDescriptor(Vehicle.class);
+ computerDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllComputers");
+ vehicleDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllVehicles");
+ }
+
+ // Enable outer-join on AnimalMatt hierarchy.
+ session.getDescriptor(Animal_Matt.class).getInheritancePolicy().setShouldOuterJoinSubclasses(true);
+ }
+
+ public void createTables(DatabaseSession session) {
+ dropTableConstraints(session);
+ new InheritanceTableCreator().replaceTables(session);
+
+ SchemaManager schemaManager = new SchemaManager(session);
+ if (session.getLogin().getPlatform().isOracle()) {
+ schemaManager.replaceObject(Computer.oracleView());
+ schemaManager.replaceObject(Vehicle.oracleView());
+ } else if (session.getLogin().getPlatform().isSybase()) {
+ schemaManager.replaceObject(Computer.sybaseView());
+ schemaManager.replaceObject(Vehicle.sybaseView());
+ //CREATE VIEW statement was added in MySQL 5.0.1. Uncomment it when we support MySQL 5
+ //} else if (session.getLogin().getPlatform().isMySQL()) {
+ //schemaManager.replaceObject(Computer.sybaseView());
+ //schemaManager.replaceObject(Vehicle.mySQLView());
+ }
+ }
+
+ /**
+ * Drop table constraints
+ */
+ public void dropTableConstraints(Session session) {
+ if (!SchemaManager.FAST_TABLE_CREATOR) {
+ if (session.getLogin().getPlatform().isOracle()) {
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table BUS CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table CAR CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table COMPANY CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table FUEL_VEH CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table NH_COMP CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table INH_MF CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table KING_DEVELOPER CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table KING_PERSONG CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table PARTNUMS CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+
+ try {
+ session.executeNonSelectingCall(new SQLCall("drop table VEHICLE CASCADE CONSTRAINTS"));
+ } catch (Exception e) {}
+ }
+
+ // Drop old constraints.
+ try {
+ if (session.getPlatform().supportsUniqueKeyConstraints()
+ && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
+ if (session.getPlatform().isMySQL()) {
+ session.executeNonSelectingSQL("Alter TABLE PROJECT_WORKER_BATCH DROP FOREIGN KEY PROJECT_WORKER_BATCH_HD");
+ session.executeNonSelectingSQL("Alter TABLE PROJECT_BATCH DROP FOREIGN KEY PROJECT_WORKER_BATCH_FK");
+ session.executeNonSelectingSQL("Alter TABLE ALLIGATOR DROP FOREIGN KEY FK_ALLIGATOR_VICTIM_ID");
+ session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP FOREIGN KEY PERSON2_PERSON2_FRND");
+ session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP FOREIGN KEY PERSON2_PERSON2_REP");
+ session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP FOREIGN KEY PERSON2_PERSON2_BS");
+ } else {
+ session.executeNonSelectingSQL("Alter TABLE PROJECT_WORKER_BATCH DROP CONSTRAINT PROJECT_WORKER_BATCH_HD");
+ session.executeNonSelectingSQL("Alter TABLE PROJECT_BATCH DROP CONSTRAINT PROJECT_WORKER_BATCH_FK");
+ session.executeNonSelectingSQL("Alter TABLE ALLIGATOR DROP CONSTRAINT FK_ALLIGATOR_VICTIM_ID");
+ session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP CONSTRAINT PERSON2_PERSON2_FRND");
+ session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP CONSTRAINT PERSON2_PERSON2_REP");
+ session.executeNonSelectingSQL("Alter TABLE PERSON2 DROP CONSTRAINT PERSON2_PERSON2_BS");
+ }
+ }
+ } catch (Exception ignore) {}
+ }
+ }
+
+ public void populate(DatabaseSession session) {
+ PopulationManager manager = PopulationManager.getDefaultManager();
+
+ Cat cat = Cat.example1();
+ session.writeObject(cat);
+ manager.registerObject(cat, "catExample1");
+
+ Dog dog = Dog.example1();
+ session.writeObject(dog);
+ manager.registerObject(dog, "dogExample1");
+
+ cat = Cat.example2();
+ session.writeObject(cat);
+ manager.registerObject(cat, "catExample2");
+
+ dog = Dog.example2();
+ session.writeObject(dog);
+ manager.registerObject(dog, "dogExample2");
+
+ cat = Cat.example3();
+ session.writeObject(cat);
+ manager.registerObject(cat, "catExample3");
+
+ dog = Dog.example3();
+ session.writeObject(dog);
+ manager.registerObject(dog, "dogExample3");
+
+ Company company = Company.example1();
+ session.writeObject(company);
+ manager.registerObject(company, "example1");
+
+ manager.registerObject(((Vector)company.getVehicles().getValue()).firstElement(), "example1");
+
+ company = Company.example2();
+ session.writeObject(company);
+ manager.registerObject(company, "example2");
+
+ company = Company.example3();
+ session.writeObject(company);
+ manager.registerObject(company, "example3");
+
+ Person person = Person.example1();
+ session.writeObject(person);
+ manager.registerObject(person, "example1");
+
+ //populate the data for duplicate field testing
+ session.writeObject(A_King2.exp1());
+ session.writeObject(A_King2.exp2());
+ session.writeObject(A_1_King2.exp3());
+ session.writeObject(A_2_King2.exp4());
+ session.writeObject(A_2_1_King2.exp5());
+
+ UnitOfWork unitOfWork = session.acquireUnitOfWork();
+ person = Person.example2();
+ unitOfWork.registerObject(person);
+ unitOfWork.commit();
+ manager.registerObject(person, "example2");
+ manager.registerObject(person.bestFriend, "example5");
+ manager.registerObject(person.representitive, "example4");
+
+ person = Person.example3();
+ session.writeObject(person);
+ manager.registerObject(person, "example3");
+
+ Computer computer = Computer.example1();
+ session.writeObject(computer);
+ manager.registerObject(computer, "example1");
+
+ computer = Computer.example2();
+ session.writeObject(computer);
+ manager.registerObject(computer, "example2");
+
+ computer = Computer.example3();
+ session.writeObject(computer);
+ manager.registerObject(computer, "example3");
+
+ computer = Computer.example4();
+ session.writeObject(computer);
+ manager.registerObject(computer, "example4");
+
+ computer = Computer.example5();
+ session.writeObject(computer);
+ manager.registerObject(computer, "example5");
+
+ JavaProgrammer JP = JavaProgrammer.example1();
+ session.writeObject(JP);
+ manager.registerObject(JP, "example1");
+
+ JP = JavaProgrammer.example2();
+ session.writeObject(JP);
+ manager.registerObject(JP, "example2");
+
+ // Added to test bug 3019934.
+ unitOfWork = session.acquireUnitOfWork();
+ Alligator alligator = new Alligator();
+ alligator.setFavoriteSwamp("Florida");
+ alligator.setLatestVictim(JavaProgrammer.steve());
+ unitOfWork.registerObject(alligator);
+ manager.registerObject(alligator, "example1");
+ unitOfWork.commit();
+
+ //Added to test bug 6111278
+
+ unitOfWork = session.acquireUnitOfWork();
+ Entomologist bugguy = new Entomologist();
+ bugguy.setId((int)System.currentTimeMillis());
+ bugguy.setName("Gary");
+ bugguy = (Entomologist)unitOfWork.registerObject(bugguy);
+ GrassHopper insect = new GrassHopper();
+ insect.setIn_numberOfLegs(4);
+ insect.setGh_maximumJump(5);
+ insect.setEntomologist(bugguy);
+ bugguy.getInsectCollection().add(insect);
+ unitOfWork.commit();
+
+ }
+}
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/ownership/OwnershipSystem.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/ownership/OwnershipSystem.java
index 49153cd..a052856 100644
--- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/ownership/OwnershipSystem.java
+++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/ownership/OwnershipSystem.java
@@ -1,91 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.testing.models.ownership;
-
-import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform;
-import org.eclipse.persistence.sessions.*;
-import org.eclipse.persistence.testing.framework.*;
-import org.eclipse.persistence.tools.schemaframework.*;
-
-/**
- * This model is a complex ownership model. The complex ownership test cases
- * would use this model to test TopLink ownership feature.
- */
-public class OwnershipSystem extends TestSystem {
- public OwnershipSystem() {
- project = new OwnershipProject();
- }
-
- public void addDescriptors(DatabaseSession session) {
- if (project == null) {
- project = new OwnershipProject();
- }
- (session).addDescriptors(project);
- }
-
- public void createTables(DatabaseSession session) {
- // Drop old constraints.
- DatabasePlatform platform = (DatabasePlatform)session.getDatasourcePlatform();
- boolean supportsAlterTableConstraints = platform
- .supportsForeignKeyConstraints()
- || (platform.supportsUniqueColumns() && !platform
- .requiresUniqueConstraintCreationOnTableCreate());
- if (supportsAlterTableConstraints)
- try {
- session.executeNonSelectingSQL("Alter TABLE OBJECT_A DROP CONSTRAINT OWNER_A_ONE_TO_ONE_");
- session.executeNonSelectingSQL("Alter TABLE OBJECT_C DROP CONSTRAINT OWNER_C_ONE_TO_ONE_");
- } catch (Exception ignore) {
- }
- SchemaManager schemaManager = new SchemaManager(session);
-
- if (supportsAlterTableConstraints) {
- schemaManager.dropConstraints(ObjectA.tableDefinition());
- schemaManager.dropConstraints(ObjectB.tableDefinition());
- schemaManager.dropConstraints(ObjectC.tableDefinition());
- schemaManager.dropConstraints(ObjectD.tableDefinition());
- schemaManager.dropConstraints(ObjectE.tableDefinition());
- }
- schemaManager.replaceObject(ObjectA.tableDefinition());
- schemaManager.replaceObject(ObjectB.tableDefinition());
- schemaManager.replaceObject(ObjectC.tableDefinition());
- schemaManager.replaceObject(ObjectD.tableDefinition());
- schemaManager.replaceObject(ObjectE.tableDefinition());
-
- if (supportsAlterTableConstraints) {
- schemaManager.createConstraints(ObjectA.tableDefinition());
- schemaManager.createConstraints(ObjectB.tableDefinition());
- schemaManager.createConstraints(ObjectC.tableDefinition());
- schemaManager.createConstraints(ObjectD.tableDefinition());
- schemaManager.createConstraints(ObjectE.tableDefinition());
- }
-
- schemaManager.createSequences();
- }
-
- public void populate(DatabaseSession session) {
- Object instance;
- PopulationManager manager = PopulationManager.getDefaultManager();
-
- instance = ObjectA.example1();
- session.writeObject(instance);
- manager.registerObject(instance, "example1");
-
- instance = ObjectA.example2();
- session.writeObject(instance);
- manager.registerObject(instance, "example2");
-
- instance = ObjectA.example3();
- session.writeObject(instance);
- manager.registerObject(instance, "example3");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.ownership;
+
+import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform;
+import org.eclipse.persistence.sessions.*;
+import org.eclipse.persistence.testing.framework.*;
+import org.eclipse.persistence.tools.schemaframework.*;
+
+/**
+ * This model is a complex ownership model. The complex ownership test cases
+ * would use this model to test TopLink ownership feature.
+ */
+public class OwnershipSystem extends TestSystem {
+ public OwnershipSystem() {
+ project = new OwnershipProject();
+ }
+
+ public void addDescriptors(DatabaseSession session) {
+ if (project == null) {
+ project = new OwnershipProject();
+ }
+ (session).addDescriptors(project);
+ }
+
+ public void createTables(DatabaseSession session) {
+ // Drop old constraints.
+ DatabasePlatform platform = (DatabasePlatform)session.getDatasourcePlatform();
+ boolean supportsAlterTableConstraints = platform
+ .supportsForeignKeyConstraints()
+ || (platform.supportsUniqueColumns() && !platform
+ .requiresUniqueConstraintCreationOnTableCreate());
+ if (supportsAlterTableConstraints)
+ try {
+ if (platform.isMySQL()) {
+ session.executeNonSelectingSQL("Alter TABLE OBJECT_A DROP FOREIGN KEY OWNER_A_ONE_TO_ONE_");
+ session.executeNonSelectingSQL("Alter TABLE OBJECT_C DROP FOREIGN KEY OWNER_C_ONE_TO_ONE_");
+ } else {
+ session.executeNonSelectingSQL("Alter TABLE OBJECT_A DROP CONSTRAINT OWNER_A_ONE_TO_ONE_");
+ session.executeNonSelectingSQL("Alter TABLE OBJECT_C DROP CONSTRAINT OWNER_C_ONE_TO_ONE_");
+ }
+ } catch (Exception ignore) {
+ }
+ SchemaManager schemaManager = new SchemaManager(session);
+
+ if (supportsAlterTableConstraints) {
+ schemaManager.dropConstraints(ObjectA.tableDefinition());
+ schemaManager.dropConstraints(ObjectB.tableDefinition());
+ schemaManager.dropConstraints(ObjectC.tableDefinition());
+ schemaManager.dropConstraints(ObjectD.tableDefinition());
+ schemaManager.dropConstraints(ObjectE.tableDefinition());
+ }
+ schemaManager.replaceObject(ObjectA.tableDefinition());
+ schemaManager.replaceObject(ObjectB.tableDefinition());
+ schemaManager.replaceObject(ObjectC.tableDefinition());
+ schemaManager.replaceObject(ObjectD.tableDefinition());
+ schemaManager.replaceObject(ObjectE.tableDefinition());
+
+ if (supportsAlterTableConstraints) {
+ schemaManager.createConstraints(ObjectA.tableDefinition());
+ schemaManager.createConstraints(ObjectB.tableDefinition());
+ schemaManager.createConstraints(ObjectC.tableDefinition());
+ schemaManager.createConstraints(ObjectD.tableDefinition());
+ schemaManager.createConstraints(ObjectE.tableDefinition());
+ }
+
+ schemaManager.createSequences();
+ }
+
+ public void populate(DatabaseSession session) {
+ Object instance;
+ PopulationManager manager = PopulationManager.getDefaultManager();
+
+ instance = ObjectA.example1();
+ session.writeObject(instance);
+ manager.registerObject(instance, "example1");
+
+ instance = ObjectA.example2();
+ session.writeObject(instance);
+ manager.registerObject(instance, "example2");
+
+ instance = ObjectA.example3();
+ session.writeObject(instance);
+ manager.registerObject(instance, "example3");
+ }
+}
diff --git a/jpa/eclipselink.jpa.test/antbuild.xml b/jpa/eclipselink.jpa.test/antbuild.xml
index 8eebc72..0e39df3 100644
--- a/jpa/eclipselink.jpa.test/antbuild.xml
+++ b/jpa/eclipselink.jpa.test/antbuild.xml
@@ -1476,6 +1476,19 @@
<mkdir dir="${jpatest.basedir}/${run.dir}"/>
</target>
+ <!-- Test target to initialize a clean database -->
+ <target name="clear-database" depends="config-classpath">
+ <antcall target="run-test" inheritRefs="true">
+ <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.ClearDatabaseSchemaTest"/>
+ <param name="TEST_AGENT" value="-Dignore"/>
+ <param name="TEST_WEAVING" value="-Dignore"/>
+ <param name="TEST_WEAVING_OPTION" value="-Dignore"/>
+ <param name="ORM_TESTING" value="-Dignore"/>
+ <param name="RUN_PATH" value="run.classpath"/>
+ <param name="DB_URL" value="${db.url}"/>
+ </antcall>
+ </target>
+
<!-- Default test target, run the FullRegressionTestSuite -->
<target name="test" depends="clean-test, config-classpath">
<antcall target="run-test" inheritRefs="true">
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/CompositePKTableCreator.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/CompositePKTableCreator.java
index 835bd51..0b2c50a 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/CompositePKTableCreator.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/CompositePKTableCreator.java
@@ -1,1150 +1,1155 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- * 04/24/2009-2.0 Guy Pelletier
- * - 270011: JPA 2.0 MappedById support
- * 10/21/2009-2.0 Guy Pelletier
- * - 290567: mappedbyid support incomplete
- * 11/23/2009-2.0 Guy Pelletier
- * - 295790: JPA 2.0 adding @MapsId to one entity causes initialization errors in other entities
- * 05/31/2010-2.1 Guy Pelletier
- * - 314941: multiple joinColumns without referenced column names defined, no error
- * 08/13/2010-2.2 Guy Pelletier
- * - 296078: JPA 2.0 with @MapsId, em.persist generates Internal Exception IllegalArgumentException
- * 02/02/2011-2.3 Chris Delahunt
- * - 336122: ValidationException thrown for JoinColumns on OneToMany with composite primary key
- ******************************************************************************/
-
-package org.eclipse.persistence.testing.models.jpa.advanced.compositepk;
-
-import org.eclipse.persistence.sessions.DatabaseSession;
-import org.eclipse.persistence.testing.framework.TogglingFastTableCreator;
-import org.eclipse.persistence.tools.schemaframework.*;
-
-public class CompositePKTableCreator extends TogglingFastTableCreator {
- public CompositePKTableCreator() {
- setName("EJB3CompositePKProject");
-
- addTableDefinition(buildADMIN_CONTRACTTable());
- addTableDefinition(buildADMINTable());
- addTableDefinition(buildSCIENTISTTable());
- addTableDefinition(buildDEPARTMENTTable());
- addTableDefinition(buildDEPT_ADMINTable());
- addTableDefinition(buildDEPT_COMPETENCYTable());
- addTableDefinition(buildCUBICLETable());
- addTableDefinition(buildSARGEANTTable());
- addTableDefinition(buildMASTERCORPORALTable());
- addTableDefinition(buildMASTERCORPORALCLONETable());
- addTableDefinition(buildMAJORTable());
- addTableDefinition(buildMAJORGENERALTable());
- addTableDefinition(buildCAPTAINTable());
- addTableDefinition(buildBRIGADIERGENERALTable());
- addTableDefinition(buildCORPORALTable());
- addTableDefinition(buildPRIVATETable());
- addTableDefinition(buildGENERALTable());
- addTableDefinition(buildLIEUTENANTGENERALTable());
- addTableDefinition(buildLIEUTENANTTable());
- addTableDefinition(buildSECONDLIEUTENANTTable());
- addTableDefinition(buildOFFICERCADETTable());
- addTableDefinition(buildLACKEYTable());
- addTableDefinition(buildLACKEYCREWTable());
- addTableDefinition(buildOFFICETable());
- addTableDefinition(buildBOOKIETable());
- addTableDefinition(buildCELLNUMBERTable());
- addTableDefinition(buildADMINPOOLTable());
- addTableDefinition(buildGOLFCLUBHEADTable());
- addTableDefinition(buildGOLFCLUBSHAFTTable());
- addTableDefinition(buildGOLFCLUBTable());
- addTableDefinition(buildGOLFCLUBORDERTable());
- }
-
- public static TableDefinition buildBOOKIETable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_BOOKIE");
-
- FieldDefinition fieldBOOKIE_ID = new FieldDefinition();
- fieldBOOKIE_ID.setName("BOOKIE_ID");
- fieldBOOKIE_ID.setTypeName("NUMERIC");
- fieldBOOKIE_ID.setSize(15);
- fieldBOOKIE_ID.setShouldAllowNull(false);
- fieldBOOKIE_ID.setIsPrimaryKey(true);
- fieldBOOKIE_ID.setUnique(false);
- fieldBOOKIE_ID.setIsIdentity(true);
- table.addField(fieldBOOKIE_ID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(true);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public static TableDefinition buildCELLNUMBERTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_CELLNUMBER");
-
- FieldDefinition field = new FieldDefinition();
- field.setName("BOOKIE_ID");
- field.setTypeName("NUMERIC");
- field.setSize(15);
- field.setShouldAllowNull(false);
- field.setIsPrimaryKey(true);
- field.setUnique(false);
- field.setIsIdentity(false);
- field.setForeignKeyFieldName("JPA_BOOKIE.BOOKIE_ID");
- table.addField(field);
-
- FieldDefinition fieldNUMBER = new FieldDefinition();
- fieldNUMBER.setName("NUMB");
- fieldNUMBER.setTypeName("VARCHAR");
- fieldNUMBER.setSize(15);
- fieldNUMBER.setShouldAllowNull(false);
- fieldNUMBER.setIsPrimaryKey(true);
- fieldNUMBER.setUnique(false);
- fieldNUMBER.setIsIdentity(false);
- table.addField(fieldNUMBER);
-
- FieldDefinition fieldDESCRIPTION = new FieldDefinition();
- fieldDESCRIPTION.setName("DESCRIP");
- fieldDESCRIPTION.setTypeName("VARCHAR");
- fieldDESCRIPTION.setSize(40);
- fieldDESCRIPTION.setShouldAllowNull(true);
- fieldDESCRIPTION.setIsPrimaryKey(false);
- fieldDESCRIPTION.setUnique(false);
- fieldDESCRIPTION.setIsIdentity(false);
- table.addField(fieldDESCRIPTION);
-
- return table;
- }
-
- public static TableDefinition buildADMIN_CONTRACTTable(){
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_ADMIN_CONTRACT");
-
- FieldDefinition field = new FieldDefinition();
- field.setName("EMPLOYEE_EMP_ID");
- field.setTypeName("NUMERIC");
- field.setSize(15);
- field.setShouldAllowNull(false);
- field.setIsPrimaryKey(true);
- field.setUnique(false);
- field.setIsIdentity(true);
- table.addField(field);
-
- FieldDefinition field4 = new FieldDefinition();
- field4.setName("END_DATE");
- field4.setTypeName("DATE");
- field4.setSize(23);
- field4.setShouldAllowNull(true);
- field4.setIsPrimaryKey(false);
- field4.setUnique(false);
- field4.setIsIdentity(false);
- table.addField(field4);
-
- return table;
- }
-
- public static TableDefinition buildADMINTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_ADMIN");
-
- FieldDefinition field = new FieldDefinition();
- field.setName("EMPLOYEE_EMP_ID");
- field.setTypeName("NUMERIC");
- field.setSize(15);
- field.setShouldAllowNull(false);
- field.setIsPrimaryKey(true);
- field.setUnique(false);
- field.setIsIdentity(true);
- table.addField(field);
-
- FieldDefinition field1 = new FieldDefinition();
- field1.setName("CONTRACT_COMPANY");
- field1.setTypeName("VARCHAR");
- field1.setSize(40);
- field1.setShouldAllowNull(true);
- field1.setIsPrimaryKey(false);
- field1.setUnique(false);
- field1.setIsIdentity(false);
- table.addField(field1);
-
- FieldDefinition fieldVERSION = new FieldDefinition();
- fieldVERSION.setName("VERSION");
- fieldVERSION.setTypeName("NUMERIC");
- fieldVERSION.setSize(15);
- fieldVERSION.setShouldAllowNull(true);
- fieldVERSION.setIsPrimaryKey(false);
- fieldVERSION.setUnique(false);
- fieldVERSION.setIsIdentity(false);
- table.addField(fieldVERSION);
-
- return table;
- }
-
- public static TableDefinition buildBRIGADIERGENERALTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_BRIGADIER_GENERAL");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("FIRST_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("LAST_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildCAPTAINTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_CAPTAIN");
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("someOtherName");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(false);
- fieldNAME.setIsPrimaryKey(true);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("FK1");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("FK2");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildCORPORALTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_CORPORAL");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildCUBICLETable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_CUBICLE");
-
- FieldDefinition ID_field = new FieldDefinition();
- ID_field.setName("ID");
- ID_field.setTypeName("NUMERIC");
- ID_field.setSize(15);
- ID_field.setShouldAllowNull(false);
- ID_field.setIsPrimaryKey(true);
- ID_field.setUnique(false);
- ID_field.setIsIdentity(true);
- table.addField(ID_field);
-
- FieldDefinition CODE_field = new FieldDefinition();
- CODE_field.setName("CODE");
- CODE_field.setTypeName("VARCHAR");
- CODE_field.setSize(1);
- CODE_field.setShouldAllowNull(false);
- CODE_field.setIsPrimaryKey(true);
- CODE_field.setUnique(false);
- CODE_field.setIsIdentity(true);
- table.addField(CODE_field);
-
- FieldDefinition OFFICE_ID_field = new FieldDefinition();
- OFFICE_ID_field.setName("OFFICE_ID");
- OFFICE_ID_field.setTypeName("NUMERIC");
- OFFICE_ID_field.setSize(15);
- OFFICE_ID_field.setShouldAllowNull(true);
- OFFICE_ID_field.setIsPrimaryKey(false);
- OFFICE_ID_field.setUnique(false);
- OFFICE_ID_field.setIsIdentity(false);
- table.addField(OFFICE_ID_field);
-
- FieldDefinition LOCATION_field = new FieldDefinition();
- LOCATION_field.setName("OFFICE_LOC");
- LOCATION_field.setTypeName("VARCHAR");
- LOCATION_field.setSize(40);
- LOCATION_field.setShouldAllowNull(true);
- LOCATION_field.setIsPrimaryKey(false);
- LOCATION_field.setUnique(false);
- LOCATION_field.setIsIdentity(false);
- table.addField(LOCATION_field);
-
- return table;
- }
-
- public static TableDefinition buildDEPARTMENTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_DEPARTMENT");
-
- FieldDefinition NAME_field = new FieldDefinition();
- NAME_field.setName("NAME");
- NAME_field.setTypeName("VARCHAR");
- NAME_field.setSize(40);
- NAME_field.setShouldAllowNull(false);
- NAME_field.setIsPrimaryKey(true);
- NAME_field.setUnique(false);
- NAME_field.setIsIdentity(true);
- table.addField(NAME_field);
-
- FieldDefinition ROLE_field = new FieldDefinition();
- ROLE_field.setName("DROLE");
- ROLE_field.setTypeName("VARCHAR");
- ROLE_field.setSize(40);
- ROLE_field.setShouldAllowNull(false);
- ROLE_field.setIsPrimaryKey(true);
- ROLE_field.setUnique(false);
- ROLE_field.setIsIdentity(true);
- table.addField(ROLE_field);
-
- FieldDefinition LOCATION_field = new FieldDefinition();
- LOCATION_field.setName("LOCATION");
- LOCATION_field.setTypeName("VARCHAR");
- LOCATION_field.setSize(40);
- LOCATION_field.setShouldAllowNull(false);
- LOCATION_field.setIsPrimaryKey(true);
- LOCATION_field.setUnique(false);
- LOCATION_field.setIsIdentity(true);
- table.addField(LOCATION_field);
-
- return table;
- }
-
- public static TableDefinition buildDEPT_ADMINTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_DEPT_ADMIN");
-
- // SECTION: FIELD
- FieldDefinition fieldName = new FieldDefinition();
- fieldName.setName("DEPT_NAME");
- fieldName.setTypeName("VARCHAR");
- fieldName.setSize(40);
- fieldName.setShouldAllowNull(false);
- fieldName.setIsPrimaryKey(true);
- fieldName.setUnique(false);
- fieldName.setIsIdentity(false);
- //fieldName.setForeignKeyFieldName("CMP3_DEPARTMENT.NAME");
- table.addField(fieldName);
-
- FieldDefinition ROLE_field = new FieldDefinition();
- ROLE_field.setName("DEPT_ROLE");
- ROLE_field.setTypeName("VARCHAR");
- ROLE_field.setSize(40);
- ROLE_field.setShouldAllowNull(false);
- ROLE_field.setIsPrimaryKey(true);
- ROLE_field.setUnique(false);
- ROLE_field.setIsIdentity(false);
- //ROLE_field.setForeignKeyFieldName("CMP3_DEPARTMENT.ROLE");
- table.addField(ROLE_field);
-
- FieldDefinition LOCATION_field = new FieldDefinition();
- LOCATION_field.setName("DEPT_LOCATION");
- LOCATION_field.setTypeName("VARCHAR");
- LOCATION_field.setSize(40);
- LOCATION_field.setShouldAllowNull(false);
- LOCATION_field.setIsPrimaryKey(true);
- LOCATION_field.setUnique(false);
- LOCATION_field.setIsIdentity(false);
- //LOCATION_field.setForeignKeyFieldName("CMP3_DEPARTMENT.LOCATION");
- table.addField(LOCATION_field);
-
- // SECTION: FIELD
- FieldDefinition fieldEMP = new FieldDefinition();
- fieldEMP.setName("ADMIN_EMPLOYEE_EMP_ID");
- fieldEMP.setTypeName("NUMERIC");
- fieldEMP.setSize(15);
- fieldEMP.setShouldAllowNull(true);
- fieldEMP.setIsPrimaryKey(true);
- fieldEMP.setUnique(false);
- fieldEMP.setIsIdentity(false);
- //fieldEMP.setForeignKeyFieldName("CMP3_EMPLOYEE.EMP_ID");
- table.addField(fieldEMP);
-
- FieldDefinition fieldPOOL_ID = new FieldDefinition();
- fieldPOOL_ID.setName("POOL_ID");
- fieldPOOL_ID.setTypeName("NUMERIC");
- fieldPOOL_ID.setSize(15);
- fieldPOOL_ID.setShouldAllowNull(true);
- fieldPOOL_ID.setIsPrimaryKey(false);
- fieldPOOL_ID.setUnique(false);
- fieldPOOL_ID.setIsIdentity(false);
- table.addField(fieldPOOL_ID);
-
- return table;
- }
-
- public static TableDefinition buildDEPT_COMPETENCYTable() {
- TableDefinition table = new TableDefinition();
- table.setName("DEPT_COMPETENCIES");
-
- FieldDefinition NAME_field = new FieldDefinition();
- NAME_field.setName("NAME");
- NAME_field.setTypeName("VARCHAR");
- NAME_field.setSize(40);
- NAME_field.setShouldAllowNull(false);
- NAME_field.setIsPrimaryKey(true);
- NAME_field.setUnique(false);
- NAME_field.setIsIdentity(false);
- table.addField(NAME_field);
-
- FieldDefinition ROLE_field = new FieldDefinition();
- ROLE_field.setName("DROLE");
- ROLE_field.setTypeName("VARCHAR");
- ROLE_field.setSize(40);
- ROLE_field.setShouldAllowNull(false);
- ROLE_field.setIsPrimaryKey(true);
- ROLE_field.setUnique(false);
- ROLE_field.setIsIdentity(false);
- table.addField(ROLE_field);
-
- FieldDefinition LOCATION_field = new FieldDefinition();
- LOCATION_field.setName("LOCATION");
- LOCATION_field.setTypeName("VARCHAR");
- LOCATION_field.setSize(40);
- LOCATION_field.setShouldAllowNull(false);
- LOCATION_field.setIsPrimaryKey(true);
- LOCATION_field.setUnique(false);
- LOCATION_field.setIsIdentity(false);
- table.addField(LOCATION_field);
-
- FieldDefinition DESCRIP_field = new FieldDefinition();
- DESCRIP_field.setName("DESCRIP");
- DESCRIP_field.setTypeName("VARCHAR");
- DESCRIP_field.setSize(40);
- DESCRIP_field.setShouldAllowNull(true);
- DESCRIP_field.setIsPrimaryKey(true);
- DESCRIP_field.setUnique(false);
- DESCRIP_field.setIsIdentity(false);
- table.addField(DESCRIP_field);
-
- FieldDefinition RATING_field = new FieldDefinition();
- RATING_field.setName("RATING");
- RATING_field.setTypeName("NUMERIC");
- RATING_field.setSize(10);
- RATING_field.setShouldAllowNull(true);
- RATING_field.setIsPrimaryKey(false);
- RATING_field.setUnique(false);
- RATING_field.setIsIdentity(false);
- table.addField(RATING_field);
-
- return table;
- }
-
- public static TableDefinition buildGENERALTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_GENERAL");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("GENERAL_ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(true);
- table.addField(fieldID);
-
- return table;
- }
-
- public static TableDefinition buildGOLFCLUBHEADTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_GOLF_CLUB_HEAD");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(false);
- table.addField(fieldID);
-
- return table;
- }
-
- public static TableDefinition buildGOLFCLUBORDERTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_GOLF_CLUB_ORDER");
-
- FieldDefinition fieldHEAD_ID = new FieldDefinition();
- fieldHEAD_ID.setName("HEAD_ID");
- fieldHEAD_ID.setTypeName("NUMERIC");
- fieldHEAD_ID.setSize(15);
- fieldHEAD_ID.setShouldAllowNull(false);
- fieldHEAD_ID.setIsPrimaryKey(true);
- fieldHEAD_ID.setUnique(false);
- fieldHEAD_ID.setIsIdentity(false);
- table.addField(fieldHEAD_ID);
-
- FieldDefinition fieldSHAFT_ID = new FieldDefinition();
- fieldSHAFT_ID.setName("SHAFT_ID");
- fieldSHAFT_ID.setTypeName("NUMERIC");
- fieldSHAFT_ID.setSize(15);
- fieldSHAFT_ID.setShouldAllowNull(false);
- fieldSHAFT_ID.setIsPrimaryKey(true);
- fieldSHAFT_ID.setUnique(false);
- fieldSHAFT_ID.setIsIdentity(false);
- table.addField(fieldSHAFT_ID);
-
- return table;
- }
-
- public static TableDefinition buildGOLFCLUBSHAFTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_GOLF_CLUB_SHAFT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(false);
- table.addField(fieldID);
-
- return table;
- }
-
- public static TableDefinition buildGOLFCLUBTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_GOLFCLUB");
-
- FieldDefinition fieldHEAD_ID = new FieldDefinition();
- fieldHEAD_ID.setName("HEAD_ID");
- fieldHEAD_ID.setTypeName("NUMERIC");
- fieldHEAD_ID.setSize(15);
- fieldHEAD_ID.setShouldAllowNull(false);
- fieldHEAD_ID.setIsPrimaryKey(true);
- fieldHEAD_ID.setUnique(false);
- fieldHEAD_ID.setIsIdentity(false);
- table.addField(fieldHEAD_ID);
-
- FieldDefinition fieldSHAFT_ID = new FieldDefinition();
- fieldSHAFT_ID.setName("SHAFT_ID");
- fieldSHAFT_ID.setTypeName("NUMERIC");
- fieldSHAFT_ID.setSize(15);
- fieldSHAFT_ID.setShouldAllowNull(false);
- fieldSHAFT_ID.setIsPrimaryKey(true);
- fieldSHAFT_ID.setUnique(false);
- fieldSHAFT_ID.setIsIdentity(false);
- table.addField(fieldSHAFT_ID);
-
- return table;
- }
-
- public static TableDefinition buildLIEUTENANTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_LIEUTENANT");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildLACKEYTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_LACKEY");
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(true);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("FIRSTNAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("LASTNAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildLACKEYCREWTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_LACKEYCREW");
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("RANK");
- fieldNAME.setTypeName("NUMERIC");
- fieldNAME.setSize(15);
- fieldNAME.setShouldAllowNull(false);
- fieldNAME.setIsPrimaryKey(true);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("FIRSTNAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("LASTNAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildLIEUTENANTGENERALTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_LIEUTENANT_GENERAL");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("GENERAL_GENERAL_ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(true);
- fieldID.setForeignKeyFieldName("JPA_GENERAL.GENERAL_ID");
- table.addField(fieldID);
-
- return table;
- }
-
- public static TableDefinition buildMAJORTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_MAJOR");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildMAJORGENERALTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_MAJOR_GENERAL");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildMASTERCORPORALTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_MASTER_CORPORAL");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("SARGEANT_ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(true);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(false);
- fieldNAME.setIsPrimaryKey(true);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public static TableDefinition buildMASTERCORPORALCLONETable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_MASTER_CORPORAL_CLONE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("SARGEANTPK");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(true);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(false);
- fieldNAME.setIsPrimaryKey(true);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public static TableDefinition buildPRIVATETable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_PRIVATE");
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("PRIVATE_NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(false);
- fieldNAME.setIsPrimaryKey(true);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildSARGEANTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_SARGEANT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(15);
- fieldID.setShouldAllowNull(false);
- fieldID.setIsPrimaryKey(true);
- fieldID.setUnique(false);
- fieldID.setIsIdentity(true);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(40);
- fieldNAME.setShouldAllowNull(true);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setUnique(false);
- fieldNAME.setIsIdentity(false);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public static TableDefinition buildSCIENTISTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_SCIENTIST");
-
- FieldDefinition ID_NUMBER_field = new FieldDefinition();
- ID_NUMBER_field.setName("ID_NUMBER");
- ID_NUMBER_field.setTypeName("NUMERIC");
- ID_NUMBER_field.setSize(15);
- ID_NUMBER_field.setShouldAllowNull(false);
- ID_NUMBER_field.setIsPrimaryKey(true);
- ID_NUMBER_field.setUnique(false);
- ID_NUMBER_field.setIsIdentity(true);
- table.addField(ID_NUMBER_field);
-
- FieldDefinition F_NAME_field = new FieldDefinition();
- F_NAME_field.setName("F_NAME");
- F_NAME_field.setTypeName("VARCHAR");
- F_NAME_field.setSize(40);
- F_NAME_field.setShouldAllowNull(false);
- F_NAME_field.setIsPrimaryKey(true);
- F_NAME_field.setUnique(false);
- F_NAME_field.setIsIdentity(true);
- table.addField(F_NAME_field);
-
- FieldDefinition L_NAME_Field = new FieldDefinition();
- L_NAME_Field.setName("L_NAME");
- L_NAME_Field.setTypeName("VARCHAR");
- L_NAME_Field.setSize(40);
- L_NAME_Field.setShouldAllowNull(false);
- L_NAME_Field.setIsPrimaryKey(true);
- L_NAME_Field.setUnique(false);
- L_NAME_Field.setIsIdentity(true);
- table.addField(L_NAME_Field);
-
- FieldDefinition CUBE_ID_field = new FieldDefinition();
- CUBE_ID_field.setName("CUBE_ID");
- CUBE_ID_field.setTypeName("NUMERIC");
- CUBE_ID_field.setSize(15);
- CUBE_ID_field.setShouldAllowNull(true);
- CUBE_ID_field.setIsPrimaryKey(false);
- CUBE_ID_field.setUnique(false);
- CUBE_ID_field.setIsIdentity(false);
- table.addField(CUBE_ID_field);
-
- FieldDefinition CUBE_CODE_field = new FieldDefinition();
- CUBE_CODE_field.setName("CUBE_CODE");
- CUBE_CODE_field.setTypeName("VARCHAR");
- CUBE_CODE_field.setSize(1);
- CUBE_CODE_field.setShouldAllowNull(true);
- CUBE_CODE_field.setIsPrimaryKey(false);
- CUBE_CODE_field.setUnique(false);
- CUBE_CODE_field.setIsIdentity(false);
- table.addField(CUBE_CODE_field);
-
- FieldDefinition DEPT_NAME_field = new FieldDefinition();
- DEPT_NAME_field.setName("DEPT_NAME");
- DEPT_NAME_field.setTypeName("VARCHAR");
- DEPT_NAME_field.setSize(40);
- DEPT_NAME_field.setShouldAllowNull(true);
- DEPT_NAME_field.setIsPrimaryKey(false);
- DEPT_NAME_field.setUnique(false);
- DEPT_NAME_field.setIsIdentity(false);
- table.addField(DEPT_NAME_field);
-
- FieldDefinition DEPT_ROLE_field = new FieldDefinition();
- DEPT_ROLE_field.setName("DEPT_ROLE");
- DEPT_ROLE_field.setTypeName("VARCHAR");
- DEPT_ROLE_field.setSize(40);
- DEPT_ROLE_field.setShouldAllowNull(true);
- DEPT_ROLE_field.setIsPrimaryKey(false);
- DEPT_ROLE_field.setUnique(false);
- DEPT_ROLE_field.setIsIdentity(false);
- table.addField(DEPT_ROLE_field);
-
- FieldDefinition DEPT_LOCATION_field = new FieldDefinition();
- DEPT_LOCATION_field.setName("DEPT_LOCATION");
- DEPT_LOCATION_field.setTypeName("VARCHAR");
- DEPT_LOCATION_field.setSize(40);
- DEPT_LOCATION_field.setShouldAllowNull(true);
- DEPT_LOCATION_field.setIsPrimaryKey(false);
- DEPT_LOCATION_field.setUnique(false);
- DEPT_LOCATION_field.setIsIdentity(false);
- table.addField(DEPT_LOCATION_field);
-
- FieldDefinition fieldDTYPE = new FieldDefinition();
- fieldDTYPE.setName("DTYPE");
- fieldDTYPE.setTypeName("VARCHAR2");
- fieldDTYPE.setSize(20);
- fieldDTYPE.setSubSize(0);
- fieldDTYPE.setIsPrimaryKey(false);
- fieldDTYPE.setIsIdentity(false);
- fieldDTYPE.setUnique(false);
- fieldDTYPE.setShouldAllowNull(true);
- table.addField(fieldDTYPE);
-
- ForeignKeyConstraint fkConstraint1 = new ForeignKeyConstraint();
- fkConstraint1.setName("CMP3_SC_CUBICLE");
- fkConstraint1.addSourceField("CUBE_ID");
- fkConstraint1.addSourceField("CUBE_CODE");
- fkConstraint1.setTargetTable("CMP3_CUBICLE");
- fkConstraint1.addTargetField("ID");
- fkConstraint1.addTargetField("CODE");
- table.addForeignKeyConstraint(fkConstraint1);
-
- ForeignKeyConstraint fkConstraint2 = new ForeignKeyConstraint();
- fkConstraint2.setName("CMP3_SC_DEPT");
- fkConstraint2.addSourceField("DEPT_NAME");
- fkConstraint2.addSourceField("DEPT_ROLE");
- fkConstraint2.addSourceField("DEPT_LOCATION");
- fkConstraint2.setTargetTable("CMP3_DEPARTMENT");
- fkConstraint2.addTargetField("NAME");
- fkConstraint2.addTargetField("DROLE");
- fkConstraint2.addTargetField("LOCATION");
- table.addForeignKeyConstraint(fkConstraint2);
-
- return table;
- }
-
- public static TableDefinition buildSECONDLIEUTENANTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_SECOND_LIEUTENANT");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildOFFICERCADETTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OFFICER_CADET");
-
- FieldDefinition fieldF_NAME = new FieldDefinition();
- fieldF_NAME.setName("F_NAME");
- fieldF_NAME.setTypeName("VARCHAR");
- fieldF_NAME.setSize(40);
- fieldF_NAME.setShouldAllowNull(false);
- fieldF_NAME.setIsPrimaryKey(true);
- fieldF_NAME.setUnique(false);
- fieldF_NAME.setIsIdentity(false);
- table.addField(fieldF_NAME);
-
- FieldDefinition fieldL_NAME = new FieldDefinition();
- fieldL_NAME.setName("L_NAME");
- fieldL_NAME.setTypeName("VARCHAR");
- fieldL_NAME.setSize(40);
- fieldL_NAME.setShouldAllowNull(false);
- fieldL_NAME.setIsPrimaryKey(true);
- fieldL_NAME.setUnique(false);
- fieldL_NAME.setIsIdentity(false);
- table.addField(fieldL_NAME);
-
- return table;
- }
-
- public static TableDefinition buildOFFICETable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_OFFICE");
-
- FieldDefinition ID_field = new FieldDefinition();
- ID_field.setName("ID");
- ID_field.setTypeName("NUMERIC");
- ID_field.setSize(15);
- ID_field.setShouldAllowNull(true);
- ID_field.setIsPrimaryKey(true);
- ID_field.setUnique(false);
- ID_field.setIsIdentity(true);
- table.addField(ID_field);
-
- FieldDefinition NAME_field = new FieldDefinition();
- NAME_field.setName("NAME");
- NAME_field.setTypeName("VARCHAR");
- NAME_field.setSize(40);
- NAME_field.setShouldAllowNull(false);
- NAME_field.setIsPrimaryKey(false);
- NAME_field.setUnique(false);
- NAME_field.setIsIdentity(false);
- table.addField(NAME_field);
-
- FieldDefinition LOCATION_field = new FieldDefinition();
- LOCATION_field.setName("LOCATION");
- LOCATION_field.setTypeName("VARCHAR");
- LOCATION_field.setSize(40);
- LOCATION_field.setShouldAllowNull(false);
- LOCATION_field.setIsPrimaryKey(true);
- LOCATION_field.setUnique(false);
- LOCATION_field.setIsIdentity(true);
- table.addField(LOCATION_field);
-
- FieldDefinition DROLE_field = new FieldDefinition();
- DROLE_field.setName("DROLE");
- DROLE_field.setTypeName("VARCHAR");
- DROLE_field.setSize(40);
- DROLE_field.setShouldAllowNull(false);
- DROLE_field.setIsPrimaryKey(false);
- DROLE_field.setUnique(false);
- DROLE_field.setIsIdentity(false);
- table.addField(DROLE_field);
-
- return table;
- }
-
-
- public static TableDefinition buildADMINPOOLTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_ADMIN_POOL");
-
- FieldDefinition ID_field = new FieldDefinition();
- ID_field.setName("ID");
- ID_field.setTypeName("NUMERIC");
- ID_field.setSize(15);
- ID_field.setShouldAllowNull(false);
- ID_field.setIsPrimaryKey(true);
- ID_field.setUnique(false);
- ID_field.setIsIdentity(true);
- table.addField(ID_field);
-
- FieldDefinition DESCRIPTION_field = new FieldDefinition();
- DESCRIPTION_field.setName("DESCRIPTION");
- DESCRIPTION_field.setTypeName("VARCHAR");
- DESCRIPTION_field.setSize(40);
- DESCRIPTION_field.setShouldAllowNull(true);
- DESCRIPTION_field.setIsPrimaryKey(false);
- DESCRIPTION_field.setUnique(false);
- DESCRIPTION_field.setIsIdentity(false);
- table.addField(DESCRIPTION_field);
-
- return table;
- }
-
- /**
- * Dropping old foreign keys from schema change.
- */
- @Override
- public void replaceTables(DatabaseSession session) {
- try {
- if (session.getPlatform().supportsUniqueKeyConstraints()
- && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
- session.executeNonSelectingSQL("Alter table CMP3_SCIENTIST drop constraint CMP3_SCIENTIST_CUBICLE");
- session.executeNonSelectingSQL("Alter table CMP3_SCIENTIST drop constraint CMP3_SCIENTIST_DEPT");
- }
- } catch (Exception ignore) {}
- super.replaceTables(session);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ * 04/24/2009-2.0 Guy Pelletier
+ * - 270011: JPA 2.0 MappedById support
+ * 10/21/2009-2.0 Guy Pelletier
+ * - 290567: mappedbyid support incomplete
+ * 11/23/2009-2.0 Guy Pelletier
+ * - 295790: JPA 2.0 adding @MapsId to one entity causes initialization errors in other entities
+ * 05/31/2010-2.1 Guy Pelletier
+ * - 314941: multiple joinColumns without referenced column names defined, no error
+ * 08/13/2010-2.2 Guy Pelletier
+ * - 296078: JPA 2.0 with @MapsId, em.persist generates Internal Exception IllegalArgumentException
+ * 02/02/2011-2.3 Chris Delahunt
+ * - 336122: ValidationException thrown for JoinColumns on OneToMany with composite primary key
+ ******************************************************************************/
+
+package org.eclipse.persistence.testing.models.jpa.advanced.compositepk;
+
+import org.eclipse.persistence.sessions.DatabaseSession;
+import org.eclipse.persistence.testing.framework.TogglingFastTableCreator;
+import org.eclipse.persistence.tools.schemaframework.*;
+
+public class CompositePKTableCreator extends TogglingFastTableCreator {
+ public CompositePKTableCreator() {
+ setName("EJB3CompositePKProject");
+
+ addTableDefinition(buildADMIN_CONTRACTTable());
+ addTableDefinition(buildADMINTable());
+ addTableDefinition(buildSCIENTISTTable());
+ addTableDefinition(buildDEPARTMENTTable());
+ addTableDefinition(buildDEPT_ADMINTable());
+ addTableDefinition(buildDEPT_COMPETENCYTable());
+ addTableDefinition(buildCUBICLETable());
+ addTableDefinition(buildSARGEANTTable());
+ addTableDefinition(buildMASTERCORPORALTable());
+ addTableDefinition(buildMASTERCORPORALCLONETable());
+ addTableDefinition(buildMAJORTable());
+ addTableDefinition(buildMAJORGENERALTable());
+ addTableDefinition(buildCAPTAINTable());
+ addTableDefinition(buildBRIGADIERGENERALTable());
+ addTableDefinition(buildCORPORALTable());
+ addTableDefinition(buildPRIVATETable());
+ addTableDefinition(buildGENERALTable());
+ addTableDefinition(buildLIEUTENANTGENERALTable());
+ addTableDefinition(buildLIEUTENANTTable());
+ addTableDefinition(buildSECONDLIEUTENANTTable());
+ addTableDefinition(buildOFFICERCADETTable());
+ addTableDefinition(buildLACKEYTable());
+ addTableDefinition(buildLACKEYCREWTable());
+ addTableDefinition(buildOFFICETable());
+ addTableDefinition(buildBOOKIETable());
+ addTableDefinition(buildCELLNUMBERTable());
+ addTableDefinition(buildADMINPOOLTable());
+ addTableDefinition(buildGOLFCLUBHEADTable());
+ addTableDefinition(buildGOLFCLUBSHAFTTable());
+ addTableDefinition(buildGOLFCLUBTable());
+ addTableDefinition(buildGOLFCLUBORDERTable());
+ }
+
+ public static TableDefinition buildBOOKIETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_BOOKIE");
+
+ FieldDefinition fieldBOOKIE_ID = new FieldDefinition();
+ fieldBOOKIE_ID.setName("BOOKIE_ID");
+ fieldBOOKIE_ID.setTypeName("NUMERIC");
+ fieldBOOKIE_ID.setSize(15);
+ fieldBOOKIE_ID.setShouldAllowNull(false);
+ fieldBOOKIE_ID.setIsPrimaryKey(true);
+ fieldBOOKIE_ID.setUnique(false);
+ fieldBOOKIE_ID.setIsIdentity(true);
+ table.addField(fieldBOOKIE_ID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(true);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildCELLNUMBERTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_CELLNUMBER");
+
+ FieldDefinition field = new FieldDefinition();
+ field.setName("BOOKIE_ID");
+ field.setTypeName("NUMERIC");
+ field.setSize(15);
+ field.setShouldAllowNull(false);
+ field.setIsPrimaryKey(true);
+ field.setUnique(false);
+ field.setIsIdentity(false);
+ field.setForeignKeyFieldName("JPA_BOOKIE.BOOKIE_ID");
+ table.addField(field);
+
+ FieldDefinition fieldNUMBER = new FieldDefinition();
+ fieldNUMBER.setName("NUMB");
+ fieldNUMBER.setTypeName("VARCHAR");
+ fieldNUMBER.setSize(15);
+ fieldNUMBER.setShouldAllowNull(false);
+ fieldNUMBER.setIsPrimaryKey(true);
+ fieldNUMBER.setUnique(false);
+ fieldNUMBER.setIsIdentity(false);
+ table.addField(fieldNUMBER);
+
+ FieldDefinition fieldDESCRIPTION = new FieldDefinition();
+ fieldDESCRIPTION.setName("DESCRIP");
+ fieldDESCRIPTION.setTypeName("VARCHAR");
+ fieldDESCRIPTION.setSize(40);
+ fieldDESCRIPTION.setShouldAllowNull(true);
+ fieldDESCRIPTION.setIsPrimaryKey(false);
+ fieldDESCRIPTION.setUnique(false);
+ fieldDESCRIPTION.setIsIdentity(false);
+ table.addField(fieldDESCRIPTION);
+
+ return table;
+ }
+
+ public static TableDefinition buildADMIN_CONTRACTTable(){
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ADMIN_CONTRACT");
+
+ FieldDefinition field = new FieldDefinition();
+ field.setName("EMPLOYEE_EMP_ID");
+ field.setTypeName("NUMERIC");
+ field.setSize(15);
+ field.setShouldAllowNull(false);
+ field.setIsPrimaryKey(true);
+ field.setUnique(false);
+ field.setIsIdentity(true);
+ table.addField(field);
+
+ FieldDefinition field4 = new FieldDefinition();
+ field4.setName("END_DATE");
+ field4.setTypeName("DATE");
+ field4.setSize(23);
+ field4.setShouldAllowNull(true);
+ field4.setIsPrimaryKey(false);
+ field4.setUnique(false);
+ field4.setIsIdentity(false);
+ table.addField(field4);
+
+ return table;
+ }
+
+ public static TableDefinition buildADMINTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ADMIN");
+
+ FieldDefinition field = new FieldDefinition();
+ field.setName("EMPLOYEE_EMP_ID");
+ field.setTypeName("NUMERIC");
+ field.setSize(15);
+ field.setShouldAllowNull(false);
+ field.setIsPrimaryKey(true);
+ field.setUnique(false);
+ field.setIsIdentity(true);
+ table.addField(field);
+
+ FieldDefinition field1 = new FieldDefinition();
+ field1.setName("CONTRACT_COMPANY");
+ field1.setTypeName("VARCHAR");
+ field1.setSize(40);
+ field1.setShouldAllowNull(true);
+ field1.setIsPrimaryKey(false);
+ field1.setUnique(false);
+ field1.setIsIdentity(false);
+ table.addField(field1);
+
+ FieldDefinition fieldVERSION = new FieldDefinition();
+ fieldVERSION.setName("VERSION");
+ fieldVERSION.setTypeName("NUMERIC");
+ fieldVERSION.setSize(15);
+ fieldVERSION.setShouldAllowNull(true);
+ fieldVERSION.setIsPrimaryKey(false);
+ fieldVERSION.setUnique(false);
+ fieldVERSION.setIsIdentity(false);
+ table.addField(fieldVERSION);
+
+ return table;
+ }
+
+ public static TableDefinition buildBRIGADIERGENERALTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_BRIGADIER_GENERAL");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("FIRST_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("LAST_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildCAPTAINTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_CAPTAIN");
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("someOtherName");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(false);
+ fieldNAME.setIsPrimaryKey(true);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("FK1");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("FK2");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildCORPORALTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_CORPORAL");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildCUBICLETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_CUBICLE");
+
+ FieldDefinition ID_field = new FieldDefinition();
+ ID_field.setName("ID");
+ ID_field.setTypeName("NUMERIC");
+ ID_field.setSize(15);
+ ID_field.setShouldAllowNull(false);
+ ID_field.setIsPrimaryKey(true);
+ ID_field.setUnique(false);
+ ID_field.setIsIdentity(true);
+ table.addField(ID_field);
+
+ FieldDefinition CODE_field = new FieldDefinition();
+ CODE_field.setName("CODE");
+ CODE_field.setTypeName("VARCHAR");
+ CODE_field.setSize(1);
+ CODE_field.setShouldAllowNull(false);
+ CODE_field.setIsPrimaryKey(true);
+ CODE_field.setUnique(false);
+ CODE_field.setIsIdentity(true);
+ table.addField(CODE_field);
+
+ FieldDefinition OFFICE_ID_field = new FieldDefinition();
+ OFFICE_ID_field.setName("OFFICE_ID");
+ OFFICE_ID_field.setTypeName("NUMERIC");
+ OFFICE_ID_field.setSize(15);
+ OFFICE_ID_field.setShouldAllowNull(true);
+ OFFICE_ID_field.setIsPrimaryKey(false);
+ OFFICE_ID_field.setUnique(false);
+ OFFICE_ID_field.setIsIdentity(false);
+ table.addField(OFFICE_ID_field);
+
+ FieldDefinition LOCATION_field = new FieldDefinition();
+ LOCATION_field.setName("OFFICE_LOC");
+ LOCATION_field.setTypeName("VARCHAR");
+ LOCATION_field.setSize(40);
+ LOCATION_field.setShouldAllowNull(true);
+ LOCATION_field.setIsPrimaryKey(false);
+ LOCATION_field.setUnique(false);
+ LOCATION_field.setIsIdentity(false);
+ table.addField(LOCATION_field);
+
+ return table;
+ }
+
+ public static TableDefinition buildDEPARTMENTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_DEPARTMENT");
+
+ FieldDefinition NAME_field = new FieldDefinition();
+ NAME_field.setName("NAME");
+ NAME_field.setTypeName("VARCHAR");
+ NAME_field.setSize(40);
+ NAME_field.setShouldAllowNull(false);
+ NAME_field.setIsPrimaryKey(true);
+ NAME_field.setUnique(false);
+ NAME_field.setIsIdentity(true);
+ table.addField(NAME_field);
+
+ FieldDefinition ROLE_field = new FieldDefinition();
+ ROLE_field.setName("DROLE");
+ ROLE_field.setTypeName("VARCHAR");
+ ROLE_field.setSize(40);
+ ROLE_field.setShouldAllowNull(false);
+ ROLE_field.setIsPrimaryKey(true);
+ ROLE_field.setUnique(false);
+ ROLE_field.setIsIdentity(true);
+ table.addField(ROLE_field);
+
+ FieldDefinition LOCATION_field = new FieldDefinition();
+ LOCATION_field.setName("LOCATION");
+ LOCATION_field.setTypeName("VARCHAR");
+ LOCATION_field.setSize(40);
+ LOCATION_field.setShouldAllowNull(false);
+ LOCATION_field.setIsPrimaryKey(true);
+ LOCATION_field.setUnique(false);
+ LOCATION_field.setIsIdentity(true);
+ table.addField(LOCATION_field);
+
+ return table;
+ }
+
+ public static TableDefinition buildDEPT_ADMINTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_DEPT_ADMIN");
+
+ // SECTION: FIELD
+ FieldDefinition fieldName = new FieldDefinition();
+ fieldName.setName("DEPT_NAME");
+ fieldName.setTypeName("VARCHAR");
+ fieldName.setSize(40);
+ fieldName.setShouldAllowNull(false);
+ fieldName.setIsPrimaryKey(true);
+ fieldName.setUnique(false);
+ fieldName.setIsIdentity(false);
+ //fieldName.setForeignKeyFieldName("CMP3_DEPARTMENT.NAME");
+ table.addField(fieldName);
+
+ FieldDefinition ROLE_field = new FieldDefinition();
+ ROLE_field.setName("DEPT_ROLE");
+ ROLE_field.setTypeName("VARCHAR");
+ ROLE_field.setSize(40);
+ ROLE_field.setShouldAllowNull(false);
+ ROLE_field.setIsPrimaryKey(true);
+ ROLE_field.setUnique(false);
+ ROLE_field.setIsIdentity(false);
+ //ROLE_field.setForeignKeyFieldName("CMP3_DEPARTMENT.ROLE");
+ table.addField(ROLE_field);
+
+ FieldDefinition LOCATION_field = new FieldDefinition();
+ LOCATION_field.setName("DEPT_LOCATION");
+ LOCATION_field.setTypeName("VARCHAR");
+ LOCATION_field.setSize(40);
+ LOCATION_field.setShouldAllowNull(false);
+ LOCATION_field.setIsPrimaryKey(true);
+ LOCATION_field.setUnique(false);
+ LOCATION_field.setIsIdentity(false);
+ //LOCATION_field.setForeignKeyFieldName("CMP3_DEPARTMENT.LOCATION");
+ table.addField(LOCATION_field);
+
+ // SECTION: FIELD
+ FieldDefinition fieldEMP = new FieldDefinition();
+ fieldEMP.setName("ADMIN_EMPLOYEE_EMP_ID");
+ fieldEMP.setTypeName("NUMERIC");
+ fieldEMP.setSize(15);
+ fieldEMP.setShouldAllowNull(true);
+ fieldEMP.setIsPrimaryKey(true);
+ fieldEMP.setUnique(false);
+ fieldEMP.setIsIdentity(false);
+ //fieldEMP.setForeignKeyFieldName("CMP3_EMPLOYEE.EMP_ID");
+ table.addField(fieldEMP);
+
+ FieldDefinition fieldPOOL_ID = new FieldDefinition();
+ fieldPOOL_ID.setName("POOL_ID");
+ fieldPOOL_ID.setTypeName("NUMERIC");
+ fieldPOOL_ID.setSize(15);
+ fieldPOOL_ID.setShouldAllowNull(true);
+ fieldPOOL_ID.setIsPrimaryKey(false);
+ fieldPOOL_ID.setUnique(false);
+ fieldPOOL_ID.setIsIdentity(false);
+ table.addField(fieldPOOL_ID);
+
+ return table;
+ }
+
+ public static TableDefinition buildDEPT_COMPETENCYTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("DEPT_COMPETENCIES");
+
+ FieldDefinition NAME_field = new FieldDefinition();
+ NAME_field.setName("NAME");
+ NAME_field.setTypeName("VARCHAR");
+ NAME_field.setSize(40);
+ NAME_field.setShouldAllowNull(false);
+ NAME_field.setIsPrimaryKey(true);
+ NAME_field.setUnique(false);
+ NAME_field.setIsIdentity(false);
+ table.addField(NAME_field);
+
+ FieldDefinition ROLE_field = new FieldDefinition();
+ ROLE_field.setName("DROLE");
+ ROLE_field.setTypeName("VARCHAR");
+ ROLE_field.setSize(40);
+ ROLE_field.setShouldAllowNull(false);
+ ROLE_field.setIsPrimaryKey(true);
+ ROLE_field.setUnique(false);
+ ROLE_field.setIsIdentity(false);
+ table.addField(ROLE_field);
+
+ FieldDefinition LOCATION_field = new FieldDefinition();
+ LOCATION_field.setName("LOCATION");
+ LOCATION_field.setTypeName("VARCHAR");
+ LOCATION_field.setSize(40);
+ LOCATION_field.setShouldAllowNull(false);
+ LOCATION_field.setIsPrimaryKey(true);
+ LOCATION_field.setUnique(false);
+ LOCATION_field.setIsIdentity(false);
+ table.addField(LOCATION_field);
+
+ FieldDefinition DESCRIP_field = new FieldDefinition();
+ DESCRIP_field.setName("DESCRIP");
+ DESCRIP_field.setTypeName("VARCHAR");
+ DESCRIP_field.setSize(40);
+ DESCRIP_field.setShouldAllowNull(true);
+ DESCRIP_field.setIsPrimaryKey(true);
+ DESCRIP_field.setUnique(false);
+ DESCRIP_field.setIsIdentity(false);
+ table.addField(DESCRIP_field);
+
+ FieldDefinition RATING_field = new FieldDefinition();
+ RATING_field.setName("RATING");
+ RATING_field.setTypeName("NUMERIC");
+ RATING_field.setSize(10);
+ RATING_field.setShouldAllowNull(true);
+ RATING_field.setIsPrimaryKey(false);
+ RATING_field.setUnique(false);
+ RATING_field.setIsIdentity(false);
+ table.addField(RATING_field);
+
+ return table;
+ }
+
+ public static TableDefinition buildGENERALTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_GENERAL");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("GENERAL_ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(true);
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public static TableDefinition buildGOLFCLUBHEADTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_GOLF_CLUB_HEAD");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(false);
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public static TableDefinition buildGOLFCLUBORDERTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_GOLF_CLUB_ORDER");
+
+ FieldDefinition fieldHEAD_ID = new FieldDefinition();
+ fieldHEAD_ID.setName("HEAD_ID");
+ fieldHEAD_ID.setTypeName("NUMERIC");
+ fieldHEAD_ID.setSize(15);
+ fieldHEAD_ID.setShouldAllowNull(false);
+ fieldHEAD_ID.setIsPrimaryKey(true);
+ fieldHEAD_ID.setUnique(false);
+ fieldHEAD_ID.setIsIdentity(false);
+ table.addField(fieldHEAD_ID);
+
+ FieldDefinition fieldSHAFT_ID = new FieldDefinition();
+ fieldSHAFT_ID.setName("SHAFT_ID");
+ fieldSHAFT_ID.setTypeName("NUMERIC");
+ fieldSHAFT_ID.setSize(15);
+ fieldSHAFT_ID.setShouldAllowNull(false);
+ fieldSHAFT_ID.setIsPrimaryKey(true);
+ fieldSHAFT_ID.setUnique(false);
+ fieldSHAFT_ID.setIsIdentity(false);
+ table.addField(fieldSHAFT_ID);
+
+ return table;
+ }
+
+ public static TableDefinition buildGOLFCLUBSHAFTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_GOLF_CLUB_SHAFT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(false);
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public static TableDefinition buildGOLFCLUBTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_GOLFCLUB");
+
+ FieldDefinition fieldHEAD_ID = new FieldDefinition();
+ fieldHEAD_ID.setName("HEAD_ID");
+ fieldHEAD_ID.setTypeName("NUMERIC");
+ fieldHEAD_ID.setSize(15);
+ fieldHEAD_ID.setShouldAllowNull(false);
+ fieldHEAD_ID.setIsPrimaryKey(true);
+ fieldHEAD_ID.setUnique(false);
+ fieldHEAD_ID.setIsIdentity(false);
+ table.addField(fieldHEAD_ID);
+
+ FieldDefinition fieldSHAFT_ID = new FieldDefinition();
+ fieldSHAFT_ID.setName("SHAFT_ID");
+ fieldSHAFT_ID.setTypeName("NUMERIC");
+ fieldSHAFT_ID.setSize(15);
+ fieldSHAFT_ID.setShouldAllowNull(false);
+ fieldSHAFT_ID.setIsPrimaryKey(true);
+ fieldSHAFT_ID.setUnique(false);
+ fieldSHAFT_ID.setIsIdentity(false);
+ table.addField(fieldSHAFT_ID);
+
+ return table;
+ }
+
+ public static TableDefinition buildLIEUTENANTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_LIEUTENANT");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildLACKEYTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_LACKEY");
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(true);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("FIRSTNAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("LASTNAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildLACKEYCREWTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_LACKEYCREW");
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("RANK");
+ fieldNAME.setTypeName("NUMERIC");
+ fieldNAME.setSize(15);
+ fieldNAME.setShouldAllowNull(false);
+ fieldNAME.setIsPrimaryKey(true);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("FIRSTNAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("LASTNAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildLIEUTENANTGENERALTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_LIEUTENANT_GENERAL");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("GENERAL_GENERAL_ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(true);
+ fieldID.setForeignKeyFieldName("JPA_GENERAL.GENERAL_ID");
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public static TableDefinition buildMAJORTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_MAJOR");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildMAJORGENERALTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_MAJOR_GENERAL");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildMASTERCORPORALTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_MASTER_CORPORAL");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("SARGEANT_ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(true);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(false);
+ fieldNAME.setIsPrimaryKey(true);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildMASTERCORPORALCLONETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_MASTER_CORPORAL_CLONE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("SARGEANTPK");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(true);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(false);
+ fieldNAME.setIsPrimaryKey(true);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildPRIVATETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_PRIVATE");
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("PRIVATE_NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(false);
+ fieldNAME.setIsPrimaryKey(true);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildSARGEANTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_SARGEANT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(15);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setUnique(false);
+ fieldID.setIsIdentity(true);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(40);
+ fieldNAME.setShouldAllowNull(true);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setIsIdentity(false);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildSCIENTISTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_SCIENTIST");
+
+ FieldDefinition ID_NUMBER_field = new FieldDefinition();
+ ID_NUMBER_field.setName("ID_NUMBER");
+ ID_NUMBER_field.setTypeName("NUMERIC");
+ ID_NUMBER_field.setSize(15);
+ ID_NUMBER_field.setShouldAllowNull(false);
+ ID_NUMBER_field.setIsPrimaryKey(true);
+ ID_NUMBER_field.setUnique(false);
+ ID_NUMBER_field.setIsIdentity(true);
+ table.addField(ID_NUMBER_field);
+
+ FieldDefinition F_NAME_field = new FieldDefinition();
+ F_NAME_field.setName("F_NAME");
+ F_NAME_field.setTypeName("VARCHAR");
+ F_NAME_field.setSize(40);
+ F_NAME_field.setShouldAllowNull(false);
+ F_NAME_field.setIsPrimaryKey(true);
+ F_NAME_field.setUnique(false);
+ F_NAME_field.setIsIdentity(true);
+ table.addField(F_NAME_field);
+
+ FieldDefinition L_NAME_Field = new FieldDefinition();
+ L_NAME_Field.setName("L_NAME");
+ L_NAME_Field.setTypeName("VARCHAR");
+ L_NAME_Field.setSize(40);
+ L_NAME_Field.setShouldAllowNull(false);
+ L_NAME_Field.setIsPrimaryKey(true);
+ L_NAME_Field.setUnique(false);
+ L_NAME_Field.setIsIdentity(true);
+ table.addField(L_NAME_Field);
+
+ FieldDefinition CUBE_ID_field = new FieldDefinition();
+ CUBE_ID_field.setName("CUBE_ID");
+ CUBE_ID_field.setTypeName("NUMERIC");
+ CUBE_ID_field.setSize(15);
+ CUBE_ID_field.setShouldAllowNull(true);
+ CUBE_ID_field.setIsPrimaryKey(false);
+ CUBE_ID_field.setUnique(false);
+ CUBE_ID_field.setIsIdentity(false);
+ table.addField(CUBE_ID_field);
+
+ FieldDefinition CUBE_CODE_field = new FieldDefinition();
+ CUBE_CODE_field.setName("CUBE_CODE");
+ CUBE_CODE_field.setTypeName("VARCHAR");
+ CUBE_CODE_field.setSize(1);
+ CUBE_CODE_field.setShouldAllowNull(true);
+ CUBE_CODE_field.setIsPrimaryKey(false);
+ CUBE_CODE_field.setUnique(false);
+ CUBE_CODE_field.setIsIdentity(false);
+ table.addField(CUBE_CODE_field);
+
+ FieldDefinition DEPT_NAME_field = new FieldDefinition();
+ DEPT_NAME_field.setName("DEPT_NAME");
+ DEPT_NAME_field.setTypeName("VARCHAR");
+ DEPT_NAME_field.setSize(40);
+ DEPT_NAME_field.setShouldAllowNull(true);
+ DEPT_NAME_field.setIsPrimaryKey(false);
+ DEPT_NAME_field.setUnique(false);
+ DEPT_NAME_field.setIsIdentity(false);
+ table.addField(DEPT_NAME_field);
+
+ FieldDefinition DEPT_ROLE_field = new FieldDefinition();
+ DEPT_ROLE_field.setName("DEPT_ROLE");
+ DEPT_ROLE_field.setTypeName("VARCHAR");
+ DEPT_ROLE_field.setSize(40);
+ DEPT_ROLE_field.setShouldAllowNull(true);
+ DEPT_ROLE_field.setIsPrimaryKey(false);
+ DEPT_ROLE_field.setUnique(false);
+ DEPT_ROLE_field.setIsIdentity(false);
+ table.addField(DEPT_ROLE_field);
+
+ FieldDefinition DEPT_LOCATION_field = new FieldDefinition();
+ DEPT_LOCATION_field.setName("DEPT_LOCATION");
+ DEPT_LOCATION_field.setTypeName("VARCHAR");
+ DEPT_LOCATION_field.setSize(40);
+ DEPT_LOCATION_field.setShouldAllowNull(true);
+ DEPT_LOCATION_field.setIsPrimaryKey(false);
+ DEPT_LOCATION_field.setUnique(false);
+ DEPT_LOCATION_field.setIsIdentity(false);
+ table.addField(DEPT_LOCATION_field);
+
+ FieldDefinition fieldDTYPE = new FieldDefinition();
+ fieldDTYPE.setName("DTYPE");
+ fieldDTYPE.setTypeName("VARCHAR2");
+ fieldDTYPE.setSize(20);
+ fieldDTYPE.setSubSize(0);
+ fieldDTYPE.setIsPrimaryKey(false);
+ fieldDTYPE.setIsIdentity(false);
+ fieldDTYPE.setUnique(false);
+ fieldDTYPE.setShouldAllowNull(true);
+ table.addField(fieldDTYPE);
+
+ ForeignKeyConstraint fkConstraint1 = new ForeignKeyConstraint();
+ fkConstraint1.setName("CMP3_SC_CUBICLE");
+ fkConstraint1.addSourceField("CUBE_ID");
+ fkConstraint1.addSourceField("CUBE_CODE");
+ fkConstraint1.setTargetTable("CMP3_CUBICLE");
+ fkConstraint1.addTargetField("ID");
+ fkConstraint1.addTargetField("CODE");
+ table.addForeignKeyConstraint(fkConstraint1);
+
+ ForeignKeyConstraint fkConstraint2 = new ForeignKeyConstraint();
+ fkConstraint2.setName("CMP3_SC_DEPT");
+ fkConstraint2.addSourceField("DEPT_NAME");
+ fkConstraint2.addSourceField("DEPT_ROLE");
+ fkConstraint2.addSourceField("DEPT_LOCATION");
+ fkConstraint2.setTargetTable("CMP3_DEPARTMENT");
+ fkConstraint2.addTargetField("NAME");
+ fkConstraint2.addTargetField("DROLE");
+ fkConstraint2.addTargetField("LOCATION");
+ table.addForeignKeyConstraint(fkConstraint2);
+
+ return table;
+ }
+
+ public static TableDefinition buildSECONDLIEUTENANTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_SECOND_LIEUTENANT");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildOFFICERCADETTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OFFICER_CADET");
+
+ FieldDefinition fieldF_NAME = new FieldDefinition();
+ fieldF_NAME.setName("F_NAME");
+ fieldF_NAME.setTypeName("VARCHAR");
+ fieldF_NAME.setSize(40);
+ fieldF_NAME.setShouldAllowNull(false);
+ fieldF_NAME.setIsPrimaryKey(true);
+ fieldF_NAME.setUnique(false);
+ fieldF_NAME.setIsIdentity(false);
+ table.addField(fieldF_NAME);
+
+ FieldDefinition fieldL_NAME = new FieldDefinition();
+ fieldL_NAME.setName("L_NAME");
+ fieldL_NAME.setTypeName("VARCHAR");
+ fieldL_NAME.setSize(40);
+ fieldL_NAME.setShouldAllowNull(false);
+ fieldL_NAME.setIsPrimaryKey(true);
+ fieldL_NAME.setUnique(false);
+ fieldL_NAME.setIsIdentity(false);
+ table.addField(fieldL_NAME);
+
+ return table;
+ }
+
+ public static TableDefinition buildOFFICETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_OFFICE");
+
+ FieldDefinition ID_field = new FieldDefinition();
+ ID_field.setName("ID");
+ ID_field.setTypeName("NUMERIC");
+ ID_field.setSize(15);
+ ID_field.setShouldAllowNull(true);
+ ID_field.setIsPrimaryKey(true);
+ ID_field.setUnique(false);
+ ID_field.setIsIdentity(true);
+ table.addField(ID_field);
+
+ FieldDefinition NAME_field = new FieldDefinition();
+ NAME_field.setName("NAME");
+ NAME_field.setTypeName("VARCHAR");
+ NAME_field.setSize(40);
+ NAME_field.setShouldAllowNull(false);
+ NAME_field.setIsPrimaryKey(false);
+ NAME_field.setUnique(false);
+ NAME_field.setIsIdentity(false);
+ table.addField(NAME_field);
+
+ FieldDefinition LOCATION_field = new FieldDefinition();
+ LOCATION_field.setName("LOCATION");
+ LOCATION_field.setTypeName("VARCHAR");
+ LOCATION_field.setSize(40);
+ LOCATION_field.setShouldAllowNull(false);
+ LOCATION_field.setIsPrimaryKey(true);
+ LOCATION_field.setUnique(false);
+ LOCATION_field.setIsIdentity(true);
+ table.addField(LOCATION_field);
+
+ FieldDefinition DROLE_field = new FieldDefinition();
+ DROLE_field.setName("DROLE");
+ DROLE_field.setTypeName("VARCHAR");
+ DROLE_field.setSize(40);
+ DROLE_field.setShouldAllowNull(false);
+ DROLE_field.setIsPrimaryKey(false);
+ DROLE_field.setUnique(false);
+ DROLE_field.setIsIdentity(false);
+ table.addField(DROLE_field);
+
+ return table;
+ }
+
+
+ public static TableDefinition buildADMINPOOLTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ADMIN_POOL");
+
+ FieldDefinition ID_field = new FieldDefinition();
+ ID_field.setName("ID");
+ ID_field.setTypeName("NUMERIC");
+ ID_field.setSize(15);
+ ID_field.setShouldAllowNull(false);
+ ID_field.setIsPrimaryKey(true);
+ ID_field.setUnique(false);
+ ID_field.setIsIdentity(true);
+ table.addField(ID_field);
+
+ FieldDefinition DESCRIPTION_field = new FieldDefinition();
+ DESCRIPTION_field.setName("DESCRIPTION");
+ DESCRIPTION_field.setTypeName("VARCHAR");
+ DESCRIPTION_field.setSize(40);
+ DESCRIPTION_field.setShouldAllowNull(true);
+ DESCRIPTION_field.setIsPrimaryKey(false);
+ DESCRIPTION_field.setUnique(false);
+ DESCRIPTION_field.setIsIdentity(false);
+ table.addField(DESCRIPTION_field);
+
+ return table;
+ }
+
+ /**
+ * Dropping old foreign keys from schema change.
+ */
+ @Override
+ public void replaceTables(DatabaseSession session) {
+ try {
+ if (session.getPlatform().supportsUniqueKeyConstraints()
+ && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
+ if (session.getPlatform().isMySQL()) {
+ session.executeNonSelectingSQL("Alter table CMP3_SCIENTIST drop foreign key CMP3_SCIENTIST_CUBICLE");
+ session.executeNonSelectingSQL("Alter table CMP3_SCIENTIST drop foreign key CMP3_SCIENTIST_DEPT");
+ } else {
+ session.executeNonSelectingSQL("Alter table CMP3_SCIENTIST drop constraint CMP3_SCIENTIST_CUBICLE");
+ session.executeNonSelectingSQL("Alter table CMP3_SCIENTIST drop constraint CMP3_SCIENTIST_DEPT");
+ }
+ }
+ } catch (Exception ignore) {}
+ super.replaceTables(session);
+ }
+}
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inheritance/InheritanceTableCreator.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inheritance/InheritanceTableCreator.java
index 1107f71..bc1ca28 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inheritance/InheritanceTableCreator.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inheritance/InheritanceTableCreator.java
@@ -1,2302 +1,2306 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- * 02/20/2009-1.1 Guy Pelletier
- * - 259829: TABLE_PER_CLASS with abstract classes does not work
- * 12/18/2009-2.1 Guy Pelletier
- * - 211323: Add class extractor support to the EclipseLink-ORM.XML Schema
- * 01/26/2011-2.3 Guy Pelletier
- * - 307664: Lifecycle callbacks not called for object from IndirectSet
- ******************************************************************************/
-package org.eclipse.persistence.testing.models.jpa.inheritance;
-
-import org.eclipse.persistence.sessions.DatabaseSession;
-import org.eclipse.persistence.testing.framework.TogglingFastTableCreator;
-import org.eclipse.persistence.tools.schemaframework.*;
-
-/**
- * This class was generated by the TopLink table creator generator.
- * It stores the meta-data (tables) that define the database schema.
- * @see org.eclipse.persistence.sessions.factories.TableCreatorClassGenerator
- */
-public class InheritanceTableCreator extends TogglingFastTableCreator {
- public InheritanceTableCreator() {
- setName("EJB3InheritanceProject");
-
- addTableDefinition(buildBICYCLETable());
- addTableDefinition(buildBOATTable());
- addTableDefinition(buildBUS_TIRETable());
- addTableDefinition(buildBUSTable());
- addTableDefinition(buildCOMPANYTable());
- addTableDefinition(buildFUEL_VEHTable());
- addTableDefinition(buildNONFUEL_VEHTable());
- addTableDefinition(buildSPORTSCARTable());
- addTableDefinition(buildJALOPYTable());
- addTableDefinition(buildVEHICLETable());
- addTableDefinition(buildVEHICLE_DIRECTORYTable());
- addTableDefinition(buildPERSONTable());
- addTableDefinition(buildENGINEERTable());
- addTableDefinition(buildTIREINFOTable());
- addTableDefinition(buildOFFROADTIREINFOTable());
- addTableDefinition(buildMUDTIREINFOTable());
- addTableDefinition(buildTIRERATINGCOMMENTTable());
- addTableDefinition(buildROCKTIREINFOTable());
- addTableDefinition(buildAAATable());
- addTableDefinition(buildAAA_STRINGSETTable());
- addTableDefinition(buildBBBTable());
- addTableDefinition(buildCCCTable());
- addTableDefinition(buildDDDTable());
- addTableDefinition(buildCOMPUTERTable());
- addTableDefinition(buildDESKTOPTable());
- addTableDefinition(buildENGINEER_DESKTOPTable());
- addTableDefinition(buildLAPTOPTable());
- addTableDefinition(buildENGINEER_LAPTOPTable());
-
- // Table per class testing, all tables prefixed with TPC_
- addTableDefinition(buildWEAPONTable());
- addTableDefinition(buildDIRECTWEAPONTable());
- addTableDefinition(buildINDIRECTWEAPONTable());
- addTableDefinition(buildGUNTable());
- addTableDefinition(buildKNIFETable());
- addTableDefinition(buildPOISONTable());
- addTableDefinition(buildBOMBTable());
- addTableDefinition(buildELIMINATIONTable());
- addTableDefinition(buildDIRECTELIMINATIONTable());
- addTableDefinition(buildINDIRECTELIMINATIONTable());
- addTableDefinition(buildCONTRACTEDPERSONELTable());
- addTableDefinition(buildASSASSINTable());
- addTableDefinition(buildSPECIALASSASSINTable());
- addTableDefinition(buildSOCIALCLUBTable());
- addTableDefinition(buildPERSONELCLUBTable());
- addTableDefinition(buildSMALLASSIGNMENTTable());
- addTableDefinition(buildNICKNAMESTable());
-
- addTableDefinition(buildAPPLETable());
- addTableDefinition(buildMACBOOKTable());
- addTableDefinition(buildMACBOOKPROTable());
-
- // bug 396587
- addTableDefinition(buildTPC_SUPERCLASSTable());
- addTableDefinition(buildTPC_SUBCLASSTable());
- addTableDefinition(buildJOINED_SUPERCLASSTable());
- addTableDefinition(buildJOINED_SUBCLASSTable());
- addTableDefinition(buildSTI_SUPERCLASSTable());
-
- // Bug 404071
- addTableDefinition(buildCMP3_SEEDTable());
- addTableDefinition(buildCMP3_SEEDED_FRUITTable());
- addTableDefinition(buildCMP3_CITRUS_FRUITTable());
- }
-
- public TableDefinition buildSTI_SUPERCLASSTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_STI_SUPERCLASS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldCLASSTYPE = new FieldDefinition();
- fieldCLASSTYPE.setName("CLASSTYPE");
- fieldCLASSTYPE.setTypeName("VARCHAR2");
- fieldCLASSTYPE.setSize(3);
- fieldCLASSTYPE.setSubSize(0);
- fieldCLASSTYPE.setIsPrimaryKey(false);
- fieldCLASSTYPE.setIsIdentity(false);
- fieldCLASSTYPE.setUnique(false);
- fieldCLASSTYPE.setShouldAllowNull(false);
- table.addField(fieldCLASSTYPE);
-
- FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
- fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUPERCLASS_ATTRIBUTE.setSize(64);
- fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
- fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
- table.addField(fieldSUPERCLASS_ATTRIBUTE);
-
- FieldDefinition fieldSUBCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUBCLASS_ATTRIBUTE.setName("SUBCLASS_ATTRIBUTE");
- fieldSUBCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUBCLASS_ATTRIBUTE.setSize(64);
- fieldSUBCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUBCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUBCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUBCLASS_ATTRIBUTE.setUnique(false);
- fieldSUBCLASS_ATTRIBUTE.setShouldAllowNull(true);
- table.addField(fieldSUBCLASS_ATTRIBUTE);
-
- return table;
- }
-
- public TableDefinition buildJOINED_SUPERCLASSTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_JOINED_SUPERCLASS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldCLASSTYPE = new FieldDefinition();
- fieldCLASSTYPE.setName("CLASSTYPE");
- fieldCLASSTYPE.setTypeName("VARCHAR2");
- fieldCLASSTYPE.setSize(3);
- fieldCLASSTYPE.setSubSize(0);
- fieldCLASSTYPE.setIsPrimaryKey(false);
- fieldCLASSTYPE.setIsIdentity(false);
- fieldCLASSTYPE.setUnique(false);
- fieldCLASSTYPE.setShouldAllowNull(false);
- table.addField(fieldCLASSTYPE);
-
- FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
- fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUPERCLASS_ATTRIBUTE.setSize(64);
- fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
- fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
- table.addField(fieldSUPERCLASS_ATTRIBUTE);
-
- return table;
- }
-
- public TableDefinition buildJOINED_SUBCLASSTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_JOINED_SUBCLASS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSUBCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUBCLASS_ATTRIBUTE.setName("SUBCLASS_ATTRIBUTE");
- fieldSUBCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUBCLASS_ATTRIBUTE.setSize(64);
- fieldSUBCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUBCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUBCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUBCLASS_ATTRIBUTE.setUnique(false);
- fieldSUBCLASS_ATTRIBUTE.setShouldAllowNull(true);
- table.addField(fieldSUBCLASS_ATTRIBUTE);
-
- ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
- fkConstraint.setName("JPA_JOINED_SUBCLASS_FK1");
- fkConstraint.setTargetTable("JPA_JOINED_SUPERCLASS");
- fkConstraint.addSourceField("ID");
- fkConstraint.addTargetField("ID");
- table.addForeignKeyConstraint(fkConstraint);
-
- return table;
- }
-
- public TableDefinition buildTPC_SUPERCLASSTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_TPC_SUPERCLASS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
- fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUPERCLASS_ATTRIBUTE.setSize(64);
- fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
- fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
- table.addField(fieldSUPERCLASS_ATTRIBUTE);
-
- return table;
- }
-
- public TableDefinition buildTPC_SUBCLASSTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_TPC_SUBCLASS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
- fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUPERCLASS_ATTRIBUTE.setSize(64);
- fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
- fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
- table.addField(fieldSUPERCLASS_ATTRIBUTE);
-
- FieldDefinition fieldSUBCLASS_ATTRIBUTE = new FieldDefinition();
- fieldSUBCLASS_ATTRIBUTE.setName("SUBCLASS_ATTRIBUTE");
- fieldSUBCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
- fieldSUBCLASS_ATTRIBUTE.setSize(64);
- fieldSUBCLASS_ATTRIBUTE.setSubSize(0);
- fieldSUBCLASS_ATTRIBUTE.setIsPrimaryKey(false);
- fieldSUBCLASS_ATTRIBUTE.setIsIdentity(false);
- fieldSUBCLASS_ATTRIBUTE.setUnique(false);
- fieldSUBCLASS_ATTRIBUTE.setShouldAllowNull(true);
- table.addField(fieldSUBCLASS_ATTRIBUTE);
-
- return table;
- }
-
- public TableDefinition buildAPPLETable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_APPLE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- return table;
- }
-
- public TableDefinition buildMACBOOKTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_MACBOOK");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("JPA_APPLE.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldRAM = new FieldDefinition();
- fieldRAM.setName("RAM");
- fieldRAM.setTypeName("NUMBER");
- fieldRAM.setSize(10);
- fieldRAM.setSubSize(0);
- fieldRAM.setIsPrimaryKey(false);
- fieldRAM.setIsIdentity(false);
- fieldRAM.setUnique(false);
- fieldRAM.setShouldAllowNull(true);
- table.addField(fieldRAM);
-
- return table;
- }
-
- public TableDefinition buildMACBOOKPROTable() {
- TableDefinition table = new TableDefinition();
- table.setName("JPA_MACBOOK_PRO");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("JPA_MACBOOK.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldCOLOR = new FieldDefinition();
- fieldCOLOR.setName("COLOR");
- fieldCOLOR.setTypeName("VARCHAR2");
- fieldCOLOR.setSize(10);
- fieldCOLOR.setSubSize(0);
- fieldCOLOR.setIsPrimaryKey(false);
- fieldCOLOR.setIsIdentity(false);
- fieldCOLOR.setUnique(false);
- fieldCOLOR.setShouldAllowNull(true);
- table.addField(fieldCOLOR);
-
- return table;
- }
-
- public TableDefinition buildBICYCLETable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_BICYCLE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_NONFUEL_VEH.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR2");
- fieldDESCRIP.setSize(10);
- fieldDESCRIP.setSubSize(0);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- return table;
- }
-
- public TableDefinition buildBOATTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_BOAT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("BOAT_ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_NONFUEL_VEH.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldMODEL = new FieldDefinition();
- fieldMODEL.setName("MODEL");
- fieldMODEL.setTypeName("VARCHAR2");
- fieldMODEL.setSize(10);
- fieldMODEL.setSubSize(0);
- fieldMODEL.setIsPrimaryKey(false);
- fieldMODEL.setIsIdentity(false);
- fieldMODEL.setUnique(false);
- fieldMODEL.setShouldAllowNull(true);
- table.addField(fieldMODEL);
-
- return table;
- }
-
- public TableDefinition buildBUS_TIRETable(){
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_BUS_CMP3_TIRE");
-
- FieldDefinition fieldBusID = new FieldDefinition();
- fieldBusID.setName("Bus_ID");
- fieldBusID.setTypeName("NUMBER");
- fieldBusID.setSize(15);
- fieldBusID.setSubSize(0);
- fieldBusID.setIsPrimaryKey(true);
- fieldBusID.setIsIdentity(false);
- fieldBusID.setUnique(false);
- fieldBusID.setShouldAllowNull(false);
- fieldBusID.setForeignKeyFieldName("CMP3_BUS.BUS_ID");
- table.addField(fieldBusID);
-
- FieldDefinition fieldTireID = new FieldDefinition();
- fieldTireID.setName("tires_ID");
- fieldTireID.setTypeName("NUMBER");
- fieldTireID.setSize(15);
- fieldTireID.setSubSize(0);
- fieldTireID.setIsPrimaryKey(true);
- fieldTireID.setIsIdentity(false);
- fieldTireID.setUnique(false);
- fieldTireID.setShouldAllowNull(false);
- fieldTireID.setForeignKeyFieldName("CMP3_TIRE.ID");
- table.addField(fieldTireID);
-
- return table;
- }
-
- public TableDefinition buildBUSTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_BUS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("BUS_ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_FUEL_VEH.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldDRIVER_ID = new FieldDefinition();
- fieldDRIVER_ID.setName("DRIVER_ID");
- fieldDRIVER_ID.setTypeName("NUMBER");
- fieldDRIVER_ID.setSize(15);
- fieldDRIVER_ID.setSubSize(0);
- fieldDRIVER_ID.setIsPrimaryKey(false);
- fieldDRIVER_ID.setIsIdentity(false);
- fieldDRIVER_ID.setUnique(false);
- fieldDRIVER_ID.setShouldAllowNull(true);
- table.addField(fieldDRIVER_ID);
-
- ForeignKeyConstraint foreignKeyBUS_PERSON = new ForeignKeyConstraint();
- foreignKeyBUS_PERSON.setName("BUSDRIVER_ID");
- foreignKeyBUS_PERSON.setTargetTable("CMP3_PERSON");
- foreignKeyBUS_PERSON.addSourceField("DRIVER_ID");
- foreignKeyBUS_PERSON.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyBUS_PERSON);
-
- return table;
- }
-
- public TableDefinition buildROCKTIREINFOTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_ROCK_TIRE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_OFFROAD_TIRE.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldGRIP = new FieldDefinition();
- fieldGRIP.setName("GRIP");
- fieldGRIP.setTypeName("NUMBER");
- fieldGRIP.setSize(15);
- fieldGRIP.setSubSize(0);
- fieldGRIP.setIsPrimaryKey(false);
- fieldGRIP.setIsIdentity(false);
- fieldGRIP.setUnique(false);
- fieldGRIP.setShouldAllowNull(true);
- table.addField(fieldGRIP);
-
- return table;
- }
-
- public TableDefinition buildSPORTSCARTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_SPORTS_CAR");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_FUEL_VEH.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldFUEL_CAP = new FieldDefinition();
- fieldFUEL_CAP.setName("MAX_SPEED");
- fieldFUEL_CAP.setTypeName("NUMBER");
- fieldFUEL_CAP.setSize(10);
- fieldFUEL_CAP.setSubSize(0);
- fieldFUEL_CAP.setIsPrimaryKey(false);
- fieldFUEL_CAP.setIsIdentity(false);
- fieldFUEL_CAP.setUnique(false);
- fieldFUEL_CAP.setShouldAllowNull(true);
- table.addField(fieldFUEL_CAP);
-
- return table;
- }
-
- public TableDefinition buildJALOPYTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_JALOPY");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_FUEL_VEH.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldRUST = new FieldDefinition();
- fieldRUST.setName("PERCENTRUST");
- fieldRUST.setTypeName("NUMBER");
- fieldRUST.setSize(10);
- fieldRUST.setSubSize(0);
- fieldRUST.setIsPrimaryKey(false);
- fieldRUST.setIsIdentity(false);
- fieldRUST.setUnique(false);
- fieldRUST.setShouldAllowNull(true);
- table.addField(fieldRUST);
-
- return table;
- }
- public TableDefinition buildCOMPANYTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_COMPANY");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR2");
- fieldNAME.setSize(100);
- fieldNAME.setSubSize(0);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(false);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public TableDefinition buildFUEL_VEHTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_FUEL_VEH");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_VEHICLE.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR2");
- fieldDESCRIP.setSize(30);
- fieldDESCRIP.setSubSize(0);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldFUEL_CAP = new FieldDefinition();
- fieldFUEL_CAP.setName("FUEL_CAP");
- fieldFUEL_CAP.setTypeName("NUMBER");
- fieldFUEL_CAP.setSize(10);
- fieldFUEL_CAP.setSubSize(0);
- fieldFUEL_CAP.setIsPrimaryKey(false);
- fieldFUEL_CAP.setIsIdentity(false);
- fieldFUEL_CAP.setUnique(false);
- fieldFUEL_CAP.setShouldAllowNull(true);
- table.addField(fieldFUEL_CAP);
-
- FieldDefinition fieldFUEL_TYP = new FieldDefinition();
- fieldFUEL_TYP.setName("FUEL_TYP");
- fieldFUEL_TYP.setTypeName("VARCHAR2");
- fieldFUEL_TYP.setSize(30);
- fieldFUEL_TYP.setSubSize(0);
- fieldFUEL_TYP.setIsPrimaryKey(false);
- fieldFUEL_TYP.setIsIdentity(false);
- fieldFUEL_TYP.setUnique(false);
- fieldFUEL_TYP.setShouldAllowNull(true);
- table.addField(fieldFUEL_TYP);
-
- FieldDefinition fieldCOLOUR = new FieldDefinition();
- fieldCOLOUR.setName("COLOUR");
- fieldCOLOUR.setTypeName("VARCHAR2");
- fieldCOLOUR.setSize(20);
- fieldCOLOUR.setSubSize(0);
- fieldCOLOUR.setIsPrimaryKey(false);
- fieldCOLOUR.setIsIdentity(false);
- fieldCOLOUR.setUnique(false);
- fieldCOLOUR.setShouldAllowNull(true);
- table.addField(fieldCOLOUR);
-
- return table;
- }
-
- public TableDefinition buildMUDTIREINFOTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_MUD_TIRE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_OFFROAD_TIRE.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldTREAD = new FieldDefinition();
- fieldTREAD.setName("TREAD_DEPTH");
- fieldTREAD.setTypeName("NUMBER");
- fieldTREAD.setSize(15);
- fieldTREAD.setSubSize(0);
- fieldTREAD.setIsPrimaryKey(false);
- fieldTREAD.setIsIdentity(false);
- fieldTREAD.setUnique(false);
- fieldTREAD.setShouldAllowNull(true);
- table.addField(fieldTREAD);
-
- FieldDefinition fieldRATING = new FieldDefinition();
- fieldRATING.setName("RATING");
- fieldRATING.setTypeName("VARCHAR2");
- fieldRATING.setSize(20);
- fieldRATING.setSubSize(0);
- fieldRATING.setIsPrimaryKey(false);
- fieldRATING.setIsIdentity(false);
- fieldRATING.setUnique(false);
- fieldRATING.setShouldAllowNull(true);
- table.addField(fieldRATING);
-
- FieldDefinition fieldCOMMENT = new FieldDefinition();
- fieldCOMMENT.setName("COMMENT_ID");
- fieldCOMMENT.setTypeName("NUMBER");
- fieldCOMMENT.setSize(15);
- fieldCOMMENT.setSubSize(0);
- fieldCOMMENT.setShouldAllowNull(true);
- fieldCOMMENT.setIsPrimaryKey(false);
- fieldCOMMENT.setIsIdentity(false);
- fieldCOMMENT.setUnique(false);
- fieldCOMMENT.setForeignKeyFieldName("CMP3_TIRE_RATING_COMMENT.ID");
- table.addField(fieldCOMMENT);
-
- return table;
- }
-
- public TableDefinition buildTIRERATINGCOMMENTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_TIRE_RATING_COMMENT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR2");
- fieldDESCRIP.setSize(100);
- fieldDESCRIP.setSubSize(0);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- return table;
- }
-
- public TableDefinition buildNONFUEL_VEHTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_NONFUEL_VEH");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_VEHICLE.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldCOLOR = new FieldDefinition();
- fieldCOLOR.setName("COLOR");
- fieldCOLOR.setTypeName("VARCHAR2");
- fieldCOLOR.setSize(20);
- fieldCOLOR.setSubSize(0);
- fieldCOLOR.setIsPrimaryKey(false);
- fieldCOLOR.setIsIdentity(false);
- fieldCOLOR.setUnique(false);
- fieldCOLOR.setShouldAllowNull(true);
- table.addField(fieldCOLOR);
-
- return table;
- }
-
- public TableDefinition buildENGINEERTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_ENGINEER");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_PERSON.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldTITLE = new FieldDefinition();
- fieldTITLE.setName("TITLE");
- fieldTITLE.setTypeName("VARCHAR2");
- fieldTITLE.setSize(26);
- fieldTITLE.setSubSize(0);
- fieldTITLE.setIsPrimaryKey(false);
- fieldTITLE.setIsIdentity(false);
- fieldTITLE.setUnique(false);
- fieldTITLE.setShouldAllowNull(true);
- table.addField(fieldTITLE);
-
- FieldDefinition fieldCOMPANY_ID = new FieldDefinition();
- fieldCOMPANY_ID.setName("COMPANY_ID");
- fieldCOMPANY_ID.setTypeName("NUMBER");
- fieldCOMPANY_ID.setSize(15);
- fieldCOMPANY_ID.setSubSize(0);
- fieldCOMPANY_ID.setIsPrimaryKey(false);
- fieldCOMPANY_ID.setIsIdentity(false);
- fieldCOMPANY_ID.setUnique(false);
- fieldCOMPANY_ID.setShouldAllowNull(true);
- fieldCOMPANY_ID.setForeignKeyFieldName("CMP3_COMPANY.ID");
- table.addField(fieldCOMPANY_ID);
-
- return table;
- }
-
- public TableDefinition buildOFFROADTIREINFOTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_OFFROAD_TIRE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_TIRE.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR2");
- fieldNAME.setSize(25);
- fieldNAME.setSubSize(0);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldCODE = new FieldDefinition();
- fieldCODE.setName("CODE");
- fieldCODE.setTypeName("VARCHAR2");
- fieldCODE.setSize(20);
- fieldCODE.setSubSize(0);
- fieldCODE.setIsPrimaryKey(false);
- fieldCODE.setIsIdentity(false);
- fieldCODE.setUnique(false);
- fieldCODE.setShouldAllowNull(true);
- table.addField(fieldCODE);
-
- FieldDefinition fieldDTYPE = new FieldDefinition();
- fieldDTYPE.setName("DTYPE");
- fieldDTYPE.setTypeName("VARCHAR2");
- fieldDTYPE.setSize(15);
- fieldDTYPE.setSubSize(0);
- fieldDTYPE.setIsPrimaryKey(false);
- fieldDTYPE.setIsIdentity(false);
- fieldDTYPE.setUnique(false);
- fieldDTYPE.setShouldAllowNull(true);
- table.addField(fieldDTYPE);
-
- return table;
- }
-
- public TableDefinition buildPERSONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PERSON");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR2");
- fieldNAME.setSize(20);
- fieldNAME.setSubSize(0);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldC_TYPE = new FieldDefinition();
- fieldC_TYPE.setName("DTYPE");
- fieldC_TYPE.setTypeName("NUMBER");
- fieldC_TYPE.setSize(15);
- fieldC_TYPE.setSubSize(0);
- fieldC_TYPE.setIsPrimaryKey(false);
- fieldC_TYPE.setIsIdentity(false);
- fieldC_TYPE.setUnique(false);
- fieldC_TYPE.setShouldAllowNull(true);
- table.addField(fieldC_TYPE);
-
- FieldDefinition fieldREP_ID = new FieldDefinition();
- fieldREP_ID.setName("REP_ID");
- fieldREP_ID.setTypeName("NUMBER");
- fieldREP_ID.setSize(15);
- fieldREP_ID.setSubSize(0);
- fieldREP_ID.setIsPrimaryKey(false);
- fieldREP_ID.setIsIdentity(false);
- fieldREP_ID.setUnique(false);
- fieldREP_ID.setShouldAllowNull(true);
- table.addField(fieldREP_ID);
-
- FieldDefinition fieldFRIEND_ID = new FieldDefinition();
- fieldFRIEND_ID.setName("FRIEND_ID");
- fieldFRIEND_ID.setTypeName("NUMBER");
- fieldFRIEND_ID.setSize(15);
- fieldFRIEND_ID.setSubSize(0);
- fieldFRIEND_ID.setIsPrimaryKey(false);
- fieldFRIEND_ID.setIsIdentity(false);
- fieldFRIEND_ID.setUnique(false);
- fieldFRIEND_ID.setShouldAllowNull(true);
- table.addField(fieldFRIEND_ID);
-
- FieldDefinition fieldCAR_ID = new FieldDefinition();
- fieldCAR_ID.setName("CAR_ID");
- fieldCAR_ID.setTypeName("NUMBER");
- fieldCAR_ID.setSize(15);
- fieldCAR_ID.setSubSize(0);
- fieldCAR_ID.setIsPrimaryKey(false);
- fieldCAR_ID.setIsIdentity(false);
- fieldCAR_ID.setUnique(false);
- fieldCAR_ID.setShouldAllowNull(true);
- table.addField(fieldCAR_ID);
-
- ForeignKeyConstraint foreignKeyPERSON_CAR = new ForeignKeyConstraint();
- foreignKeyPERSON_CAR.setName("PERSON_CAR");
- foreignKeyPERSON_CAR.setTargetTable("CMP3_VEHICLE");
- foreignKeyPERSON_CAR.addSourceField("CAR_ID");
- foreignKeyPERSON_CAR.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyPERSON_CAR);
-
- ForeignKeyConstraint foreignKeyPERSON_ENGINEER = new ForeignKeyConstraint();
- foreignKeyPERSON_ENGINEER.setName("PERSON_ENGINEER");
- foreignKeyPERSON_ENGINEER.setTargetTable("CMP3_ENGINEER");
- foreignKeyPERSON_ENGINEER.addSourceField("FRIEND_ID");
- foreignKeyPERSON_ENGINEER.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyPERSON_ENGINEER);
-
- ForeignKeyConstraint foreignKeyPERSON_REP = new ForeignKeyConstraint();
- foreignKeyPERSON_REP.setName("PERSON_LAWYER");
- foreignKeyPERSON_REP.setTargetTable("CMP3_PERSON");
- foreignKeyPERSON_REP.addSourceField("REP_ID");
- foreignKeyPERSON_REP.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyPERSON_REP);
-
- return table;
- }
-
- public TableDefinition buildVEHICLETable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_VEHICLE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldTYPE = new FieldDefinition();
- fieldTYPE.setName("VEH_TYPE");
- fieldTYPE.setTypeName("VARCHAR2");
- fieldTYPE.setSize(15);
- fieldTYPE.setSubSize(0);
- fieldTYPE.setIsPrimaryKey(false);
- fieldTYPE.setIsIdentity(false);
- fieldTYPE.setUnique(false);
- fieldTYPE.setShouldAllowNull(true);
- table.addField(fieldTYPE);
-
- FieldDefinition fieldCAPACITY = new FieldDefinition();
- fieldCAPACITY.setName("CAPACITY");
- fieldCAPACITY.setTypeName("NUMBER");
- fieldCAPACITY.setSize(10);
- fieldCAPACITY.setSubSize(0);
- fieldCAPACITY.setIsPrimaryKey(false);
- fieldCAPACITY.setIsIdentity(false);
- fieldCAPACITY.setUnique(false);
- fieldCAPACITY.setShouldAllowNull(true);
- table.addField(fieldCAPACITY);
-
- FieldDefinition fieldOWNER_ID = new FieldDefinition();
- fieldOWNER_ID.setName("OWNER_ID");
- fieldOWNER_ID.setTypeName("NUMBER");
- fieldOWNER_ID.setSize(15);
- fieldOWNER_ID.setSubSize(0);
- fieldOWNER_ID.setIsPrimaryKey(false);
- fieldOWNER_ID.setIsIdentity(false);
- fieldOWNER_ID.setUnique(false);
- fieldOWNER_ID.setShouldAllowNull(true);
- table.addField(fieldOWNER_ID);
-
- FieldDefinition fieldDIRECTORY_ID = new FieldDefinition();
- fieldDIRECTORY_ID.setName("DIRECTORY_ID");
- fieldDIRECTORY_ID.setTypeName("NUMBER");
- fieldDIRECTORY_ID.setSize(15);
- fieldDIRECTORY_ID.setSubSize(0);
- fieldDIRECTORY_ID.setIsPrimaryKey(false);
- fieldDIRECTORY_ID.setIsIdentity(false);
- fieldDIRECTORY_ID.setUnique(false);
- fieldDIRECTORY_ID.setShouldAllowNull(true);
- table.addField(fieldDIRECTORY_ID);
-
- ForeignKeyConstraint foreignKeyVEHICLE_COMPANY = new ForeignKeyConstraint();
- foreignKeyVEHICLE_COMPANY.setName("VEHICLE_COMPANY_FK");
- foreignKeyVEHICLE_COMPANY.setTargetTable("CMP3_COMPANY");
- foreignKeyVEHICLE_COMPANY.addSourceField("OWNER_ID");
- foreignKeyVEHICLE_COMPANY.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyVEHICLE_COMPANY);
-
- ForeignKeyConstraint foreignKeyVEHICLE_DIRECTORY = new ForeignKeyConstraint();
- foreignKeyVEHICLE_DIRECTORY.setName("VEHICLE_DIRECTORY_FK");
- foreignKeyVEHICLE_DIRECTORY.setTargetTable("CMP3_VEHICLE_DIRECTORY");
- foreignKeyVEHICLE_DIRECTORY.addSourceField("DIRECTORY_ID");
- foreignKeyVEHICLE_DIRECTORY.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyVEHICLE_DIRECTORY);
-
-
- return table;
- }
-
- public TableDefinition buildVEHICLE_DIRECTORYTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_VEHICLE_DIRECTORY");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR2");
- fieldNAME.setSize(15);
- fieldNAME.setSubSize(0);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public TableDefinition buildTIREINFOTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_TIRE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- fieldID = new FieldDefinition();
- fieldID.setName("PRESSURE");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(false);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(true);
- table.addField(fieldID);
-
- fieldID = new FieldDefinition();
- fieldID.setName("SPEEDRATING");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(false);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(true);
- table.addField(fieldID);
-
- FieldDefinition fieldTYPE = new FieldDefinition();
- fieldTYPE.setName("TIRE_TYPE");
- fieldTYPE.setTypeName("VARCHAR2");
- fieldTYPE.setSize(15);
- fieldTYPE.setSubSize(0);
- fieldTYPE.setIsPrimaryKey(false);
- fieldTYPE.setIsIdentity(false);
- fieldTYPE.setUnique(false);
- fieldTYPE.setShouldAllowNull(true);
- table.addField(fieldTYPE);
-
- return table;
- }
-
- public TableDefinition buildAAATable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_AAA");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldDTYPES = new FieldDefinition();
- fieldDTYPES.setName("DTYPES");
- fieldDTYPES.setTypeName("VARCHAR");
- fieldDTYPES.setSize(2);
- fieldDTYPES.setIsPrimaryKey(false);
- fieldDTYPES.setIsIdentity(false);
- fieldDTYPES.setUnique(false);
- fieldDTYPES.setShouldAllowNull(true);
- table.addField(fieldDTYPES);
-
- FieldDefinition fieldSTRINGDATA = new FieldDefinition();
- fieldSTRINGDATA.setName("FOO");
- fieldSTRINGDATA.setTypeName("VARCHAR");
- fieldSTRINGDATA.setSize(30);
- fieldSTRINGDATA.setIsPrimaryKey(false);
- fieldSTRINGDATA.setIsIdentity(false);
- fieldSTRINGDATA.setUnique(false);
- fieldSTRINGDATA.setShouldAllowNull(true);
- table.addField(fieldSTRINGDATA);
-
- return table;
- }
-
- public static TableDefinition buildAAA_STRINGSETTable() {
- TableDefinition table = new TableDefinition();
- table.setName("AAA_STRINGSET");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("AAA_ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);//needed to prevent duplicates
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition DESCRIP_field = new FieldDefinition();
- DESCRIP_field.setName("STRINGSET");
- DESCRIP_field.setTypeName("VARCHAR");
- DESCRIP_field.setSize(40);
- fieldID.setIsPrimaryKey(true);//needed to prevent duplicates
- DESCRIP_field.setIsPrimaryKey(false);
- DESCRIP_field.setUnique(false);
- DESCRIP_field.setIsIdentity(false);
- table.addField(DESCRIP_field);
-
- return table;
- }
-
- public TableDefinition buildBBBTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_BBB");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_AAA.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldSTRINGDATA = new FieldDefinition();
- fieldSTRINGDATA.setName("BAR");
- fieldSTRINGDATA.setTypeName("VARCHAR");
- fieldSTRINGDATA.setSize(30);
- fieldSTRINGDATA.setIsPrimaryKey(false);
- fieldSTRINGDATA.setIsIdentity(false);
- fieldSTRINGDATA.setUnique(false);
- fieldSTRINGDATA.setShouldAllowNull(true);
- table.addField(fieldSTRINGDATA);
-
- return table;
- }
-
- public TableDefinition buildCCCTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_CCC");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_BBB.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldSTRINGDATA = new FieldDefinition();
- fieldSTRINGDATA.setName("XYZ");
- fieldSTRINGDATA.setTypeName("VARCHAR");
- fieldSTRINGDATA.setSize(30);
- fieldSTRINGDATA.setIsPrimaryKey(false);
- fieldSTRINGDATA.setIsIdentity(false);
- fieldSTRINGDATA.setUnique(false);
- fieldSTRINGDATA.setShouldAllowNull(true);
- table.addField(fieldSTRINGDATA);
-
- return table;
- }
-
- public TableDefinition buildDDDTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_DDD");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(15);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldPOSTLOADCOUNT = new FieldDefinition();
- fieldPOSTLOADCOUNT.setName("POST_LOAD_COUNT");
- fieldPOSTLOADCOUNT.setTypeName("NUMBER");
- fieldPOSTLOADCOUNT.setSize(15);
- fieldPOSTLOADCOUNT.setSubSize(0);
- fieldPOSTLOADCOUNT.setIsPrimaryKey(false);
- fieldPOSTLOADCOUNT.setIsIdentity(false);
- fieldPOSTLOADCOUNT.setUnique(false);
- fieldPOSTLOADCOUNT.setShouldAllowNull(true);
- table.addField(fieldPOSTLOADCOUNT);
-
- FieldDefinition fieldELPOSTLOADCOUNT = new FieldDefinition();
- fieldELPOSTLOADCOUNT.setName("EL_POST_LOAD_COUNT");
- fieldELPOSTLOADCOUNT.setTypeName("NUMBER");
- fieldELPOSTLOADCOUNT.setSize(15);
- fieldELPOSTLOADCOUNT.setSubSize(0);
- fieldELPOSTLOADCOUNT.setIsPrimaryKey(false);
- fieldELPOSTLOADCOUNT.setIsIdentity(false);
- fieldELPOSTLOADCOUNT.setUnique(false);
- fieldELPOSTLOADCOUNT.setShouldAllowNull(true);
- table.addField(fieldELPOSTLOADCOUNT);
-
- FieldDefinition aaaID = new FieldDefinition();
- aaaID.setName("AAA_ID");
- aaaID.setTypeName("NUMBER");
- aaaID.setSize(15);
- aaaID.setSubSize(0);
- aaaID.setShouldAllowNull(true);
- aaaID.setIsPrimaryKey(false);
- aaaID.setUnique(false);
- aaaID.setIsIdentity(false);
- aaaID.setForeignKeyFieldName("CMP3_AAA.ID");
- table.addField(aaaID);
-
- return table;
- }
-
- public TableDefinition buildCOMPUTERTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_COMPUTER");
-
- FieldDefinition fieldMFR = new FieldDefinition();
- fieldMFR.setName("MFR");
- fieldMFR.setTypeName("VARCHAR");
- fieldMFR.setSize(30);
- fieldMFR.setIsPrimaryKey(true);
- fieldMFR.setIsIdentity(false);
- fieldMFR.setUnique(false);
- fieldMFR.setShouldAllowNull(false);
- table.addField(fieldMFR);
-
- FieldDefinition fieldSNO = new FieldDefinition();
- fieldSNO.setName("SNO");
- fieldSNO.setTypeName("NUMBER");
- fieldSNO.setSize(10);
- fieldSNO.setSubSize(0);
- fieldSNO.setIsPrimaryKey(true);
- fieldSNO.setIsIdentity(false);
- fieldSNO.setUnique(false);
- fieldSNO.setShouldAllowNull(false);
- table.addField(fieldSNO);
-
- FieldDefinition fieldDTYPE = new FieldDefinition();
- fieldDTYPE.setName("DTYPE");
- fieldDTYPE.setTypeName("VARCHAR");
- fieldDTYPE.setSize(20);
- fieldDTYPE.setIsPrimaryKey(false);
- fieldDTYPE.setIsIdentity(false);
- fieldDTYPE.setUnique(false);
- fieldDTYPE.setShouldAllowNull(true);
- table.addField(fieldDTYPE);
-
- return table;
- }
-
- public TableDefinition buildDESKTOPTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_DESKTOP");
-
- FieldDefinition fieldMFR = new FieldDefinition();
- fieldMFR.setName("DT_MFR");
- fieldMFR.setTypeName("VARCHAR");
- fieldMFR.setSize(30);
- fieldMFR.setIsPrimaryKey(true);
- fieldMFR.setIsIdentity(false);
- fieldMFR.setUnique(false);
- fieldMFR.setShouldAllowNull(false);
- table.addField(fieldMFR);
-
- FieldDefinition fieldSNO = new FieldDefinition();
- fieldSNO.setName("DT_SNO");
- fieldSNO.setTypeName("NUMBER");
- fieldSNO.setSize(10);
- fieldSNO.setSubSize(0);
- fieldSNO.setIsPrimaryKey(true);
- fieldSNO.setIsIdentity(false);
- fieldSNO.setUnique(false);
- fieldSNO.setShouldAllowNull(false);
- table.addField(fieldSNO);
-
- ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
- fkConstraint.setName("CMP3_DESKTOP_FK");
- fkConstraint.addSourceField("DT_MFR");
- fkConstraint.addSourceField("DT_SNO");
- fkConstraint.setTargetTable("CMP3_COMPUTER");
- fkConstraint.addTargetField("MFR");
- fkConstraint.addTargetField("SNO");
- table.addForeignKeyConstraint(fkConstraint);
-
- return table;
- }
-
- // Engineer-Desktop many-to-many relationship table
- public TableDefinition buildENGINEER_DESKTOPTable() {
- TableDefinition table = new TableDefinition();
-
- table.setName("CMP3_ENGINEER_DESKTOP");
-
- FieldDefinition fieldEngineerId = new FieldDefinition();
- fieldEngineerId.setName("ENGINEER_ID");
- fieldEngineerId.setTypeName("NUMBER");
- fieldEngineerId.setSize(15);
- fieldEngineerId.setSubSize(0);
- fieldEngineerId.setShouldAllowNull(false);
- fieldEngineerId.setIsPrimaryKey(true);
- fieldEngineerId.setUnique(false);
- fieldEngineerId.setIsIdentity(false);
- fieldEngineerId.setForeignKeyFieldName("CMP3_ENGINEER.ID");
- table.addField(fieldEngineerId);
-
- FieldDefinition fieldDesktopMFR = new FieldDefinition();
- fieldDesktopMFR.setName("DESKTOP_MFR");
- fieldDesktopMFR.setTypeName("VARCHAR");
- fieldDesktopMFR.setSize(30);
- fieldDesktopMFR.setIsPrimaryKey(true);
- fieldDesktopMFR.setIsIdentity(false);
- fieldDesktopMFR.setUnique(false);
- fieldDesktopMFR.setShouldAllowNull(false);
- table.addField(fieldDesktopMFR);
-
- FieldDefinition fieldDesktopSNO = new FieldDefinition();
- fieldDesktopSNO.setName("DESKTOP_SNO");
- fieldDesktopSNO.setTypeName("NUMBER");
- fieldDesktopSNO.setSize(10);
- fieldDesktopSNO.setSubSize(0);
- fieldDesktopSNO.setIsPrimaryKey(true);
- fieldDesktopSNO.setIsIdentity(false);
- fieldDesktopSNO.setUnique(false);
- fieldDesktopSNO.setShouldAllowNull(false);
- table.addField(fieldDesktopSNO);
-
- return table;
- }
-
- public TableDefinition buildLAPTOPTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_LAPTOP");
-
- FieldDefinition fieldMFR = new FieldDefinition();
- fieldMFR.setName("MFR");
- fieldMFR.setTypeName("VARCHAR");
- fieldMFR.setSize(30);
- fieldMFR.setIsPrimaryKey(true);
- fieldMFR.setIsIdentity(false);
- fieldMFR.setUnique(false);
- fieldMFR.setShouldAllowNull(false);
- table.addField(fieldMFR);
-
- FieldDefinition fieldSNO = new FieldDefinition();
- fieldSNO.setName("SNO");
- fieldSNO.setTypeName("NUMBER");
- fieldSNO.setSize(10);
- fieldSNO.setSubSize(0);
- fieldSNO.setIsPrimaryKey(true);
- fieldSNO.setIsIdentity(false);
- fieldSNO.setUnique(false);
- fieldSNO.setShouldAllowNull(false);
- table.addField(fieldSNO);
-
- // FOREIGN KEY (MFR, SNO) REFERENCES CMP3_COMPUTER (MFR, SNO)
- ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
- fkConstraint.setName("CMP3_LAPTOP_FK1");
- fkConstraint.addSourceField("MFR");
- fkConstraint.addSourceField("SNO");
- fkConstraint.setTargetTable("CMP3_COMPUTER");
- fkConstraint.addTargetField("MFR");
- fkConstraint.addTargetField("SNO");
-
- table.addForeignKeyConstraint(fkConstraint);
- return table;
- }
-
- // Engineer-Laptop many-to-many relationship table
- public TableDefinition buildENGINEER_LAPTOPTable() {
- TableDefinition table = new TableDefinition();
-
- table.setName("CMP3_ENGINEER_LAPTOP");
-
- FieldDefinition fieldEngineerId = new FieldDefinition();
- fieldEngineerId.setName("ENGINEER_ID");
- fieldEngineerId.setTypeName("NUMBER");
- fieldEngineerId.setSize(15);
- fieldEngineerId.setSubSize(0);
- fieldEngineerId.setShouldAllowNull(false);
- fieldEngineerId.setIsPrimaryKey(true);
- fieldEngineerId.setUnique(false);
- fieldEngineerId.setIsIdentity(false);
- fieldEngineerId.setForeignKeyFieldName("CMP3_ENGINEER.ID");
- table.addField(fieldEngineerId);
-
- FieldDefinition fieldLaptopMFR = new FieldDefinition();
- fieldLaptopMFR.setName("LAPTOP_MFR");
- fieldLaptopMFR.setTypeName("VARCHAR");
- fieldLaptopMFR.setSize(30);
- fieldLaptopMFR.setIsPrimaryKey(true);
- fieldLaptopMFR.setIsIdentity(false);
- fieldLaptopMFR.setUnique(false);
- fieldLaptopMFR.setShouldAllowNull(false);
- table.addField(fieldLaptopMFR);
-
- FieldDefinition fieldLaptopSNO = new FieldDefinition();
- fieldLaptopSNO.setName("LAPTOP_SNO");
- fieldLaptopSNO.setTypeName("NUMBER");
- fieldLaptopSNO.setSize(10);
- fieldLaptopSNO.setSubSize(0);
- fieldLaptopSNO.setIsPrimaryKey(true);
- fieldLaptopSNO.setIsIdentity(false);
- fieldLaptopSNO.setUnique(false);
- fieldLaptopSNO.setShouldAllowNull(false);
- table.addField(fieldLaptopSNO);
-
- // FOREIGN KEY (LAPTOP_MFR, LAPTOP_SNO) REFERENCES CMP3_LAPTOP (MFR, SNO)
- ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
- fkConstraint.setName("CMP3_ENG_LAP_FK1");
- fkConstraint.addSourceField("LAPTOP_MFR");
- fkConstraint.addSourceField("LAPTOP_SNO");
- fkConstraint.setTargetTable("CMP3_LAPTOP");
- fkConstraint.addTargetField("MFR");
- fkConstraint.addTargetField("SNO");
-
- table.addForeignKeyConstraint(fkConstraint);
- return table;
- }
-
- public TableDefinition buildWEAPONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_WEAPON");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- return table;
- }
-
- public TableDefinition buildDIRECTWEAPONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_DIR_WEAPON");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- return table;
- }
-
- public TableDefinition buildINDIRECTWEAPONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_IND_WEAPON");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- return table;
- }
-
- public TableDefinition buildGUNTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_GUN");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldCALIBER = new FieldDefinition();
- fieldCALIBER.setName("CALIBER");
- fieldCALIBER.setTypeName("NUMBER");
- fieldCALIBER.setSize(10);
- fieldCALIBER.setIsPrimaryKey(false);
- fieldCALIBER.setIsIdentity(false);
- fieldCALIBER.setUnique(false);
- fieldCALIBER.setShouldAllowNull(false);
- table.addField(fieldCALIBER);
-
- FieldDefinition fieldMODEL = new FieldDefinition();
- fieldMODEL.setName("MODEL");
- fieldMODEL.setTypeName("VARCHAR");
- fieldMODEL.setSize(50);
- fieldMODEL.setIsPrimaryKey(false);
- fieldMODEL.setIsIdentity(false);
- fieldMODEL.setUnique(false);
- fieldMODEL.setShouldAllowNull(true);
- table.addField(fieldMODEL);
-
- return table;
- }
-
- public TableDefinition buildKNIFETable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_KNIFE");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldBLADE = new FieldDefinition();
- fieldBLADE.setName("BLADE");
- fieldBLADE.setTypeName("NUMBER");
- fieldBLADE.setSize(10);
- fieldBLADE.setIsPrimaryKey(false);
- fieldBLADE.setIsIdentity(false);
- fieldBLADE.setUnique(false);
- fieldBLADE.setShouldAllowNull(false);
- table.addField(fieldBLADE);
-
- FieldDefinition fieldKNIFE_TYPE = new FieldDefinition();
- fieldKNIFE_TYPE.setName("KNIFE_TYPE");
- fieldKNIFE_TYPE.setTypeName("VARCHAR");
- fieldKNIFE_TYPE.setSize(50);
- fieldKNIFE_TYPE.setIsPrimaryKey(false);
- fieldKNIFE_TYPE.setIsIdentity(false);
- fieldKNIFE_TYPE.setUnique(false);
- fieldKNIFE_TYPE.setShouldAllowNull(true);
- table.addField(fieldKNIFE_TYPE);
-
- return table;
- }
-
- public TableDefinition buildPOISONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_POISON");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("E_TIME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public TableDefinition buildBOMBTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_BOMB");
-
- FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
- fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
- fieldSERIAL_NUMBER.setTypeName("NUMBER");
- fieldSERIAL_NUMBER.setSize(10);
- fieldSERIAL_NUMBER.setIsPrimaryKey(true);
- fieldSERIAL_NUMBER.setIsIdentity(false);
- fieldSERIAL_NUMBER.setUnique(false);
- fieldSERIAL_NUMBER.setShouldAllowNull(false);
- table.addField(fieldSERIAL_NUMBER);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldBOMB_TYPE = new FieldDefinition();
- fieldBOMB_TYPE.setName("B_TYPE");
- fieldBOMB_TYPE.setTypeName("NUMBER");
- fieldBOMB_TYPE.setSize(10);
- fieldBOMB_TYPE.setIsPrimaryKey(false);
- fieldBOMB_TYPE.setIsIdentity(false);
- fieldBOMB_TYPE.setUnique(false);
- fieldBOMB_TYPE.setShouldAllowNull(true);
- table.addField(fieldBOMB_TYPE);
-
- return table;
- }
-
- public TableDefinition buildELIMINATIONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_ELIMINATION");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(false);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldASSASSIN = new FieldDefinition();
- fieldASSASSIN.setName("ASSASSIN_ID");
- fieldASSASSIN.setTypeName("NUMBER");
- fieldASSASSIN.setSize(10);
- fieldASSASSIN.setIsPrimaryKey(false);
- fieldASSASSIN.setIsIdentity(false);
- fieldASSASSIN.setUnique(false);
- fieldASSASSIN.setShouldAllowNull(false);
- table.addField(fieldASSASSIN);
-
- return table;
- }
-
- public TableDefinition buildDIRECTELIMINATIONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_DIR_ELIMINATION");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(false);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldASSASSIN = new FieldDefinition();
- fieldASSASSIN.setName("ASSASSIN_ID");
- fieldASSASSIN.setTypeName("NUMBER");
- fieldASSASSIN.setSize(10);
- fieldASSASSIN.setIsPrimaryKey(false);
- fieldASSASSIN.setIsIdentity(false);
- fieldASSASSIN.setUnique(false);
- fieldASSASSIN.setShouldAllowNull(false);
- table.addField(fieldASSASSIN);
-
- FieldDefinition fieldWEAPON = new FieldDefinition();
- fieldWEAPON.setName("WEAPON_ID");
- fieldWEAPON.setTypeName("NUMBER");
- fieldWEAPON.setSize(10);
- fieldWEAPON.setIsPrimaryKey(false);
- fieldWEAPON.setIsIdentity(false);
- fieldWEAPON.setUnique(false);
- fieldWEAPON.setShouldAllowNull(false);
- table.addField(fieldWEAPON);
-
- return table;
- }
-
- public TableDefinition buildINDIRECTELIMINATIONTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_IND_ELIMINATION");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(false);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(false);
- table.addField(fieldNAME);
-
- FieldDefinition fieldDESCRIP = new FieldDefinition();
- fieldDESCRIP.setName("DESCRIP");
- fieldDESCRIP.setTypeName("VARCHAR");
- fieldDESCRIP.setSize(50);
- fieldDESCRIP.setIsPrimaryKey(false);
- fieldDESCRIP.setIsIdentity(false);
- fieldDESCRIP.setUnique(false);
- fieldDESCRIP.setShouldAllowNull(true);
- table.addField(fieldDESCRIP);
-
- FieldDefinition fieldASSASSIN = new FieldDefinition();
- fieldASSASSIN.setName("ASSASSIN_ID");
- fieldASSASSIN.setTypeName("NUMBER");
- fieldASSASSIN.setSize(10);
- fieldASSASSIN.setIsPrimaryKey(false);
- fieldASSASSIN.setIsIdentity(false);
- fieldASSASSIN.setUnique(false);
- fieldASSASSIN.setShouldAllowNull(false);
- table.addField(fieldASSASSIN);
-
- FieldDefinition fieldWEAPON = new FieldDefinition();
- fieldWEAPON.setName("WEAPON_ID");
- fieldWEAPON.setTypeName("NUMBER");
- fieldWEAPON.setSize(10);
- fieldWEAPON.setIsPrimaryKey(false);
- fieldWEAPON.setIsIdentity(false);
- fieldWEAPON.setUnique(false);
- fieldWEAPON.setShouldAllowNull(false);
- table.addField(fieldWEAPON);
-
- return table;
- }
-
- public TableDefinition buildCONTRACTEDPERSONELTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_PERSONEL");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldVERSION = new FieldDefinition();
- fieldVERSION.setName("VERSION");
- fieldVERSION.setTypeName("NUMERIC");
- fieldVERSION.setSize(15);
- fieldVERSION.setShouldAllowNull(true);
- fieldVERSION.setIsPrimaryKey(false);
- fieldVERSION.setUnique(false);
- fieldVERSION.setIsIdentity(false);
- table.addField(fieldVERSION);
-
- return table;
- }
-
- public TableDefinition buildASSASSINTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_ASSASSIN");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldWEAPON = new FieldDefinition();
- fieldWEAPON.setName("WEAPON_ID");
- fieldWEAPON.setTypeName("NUMBER");
- fieldWEAPON.setSize(10);
- fieldWEAPON.setIsPrimaryKey(false);
- fieldWEAPON.setIsIdentity(false);
- fieldWEAPON.setUnique(false);
- fieldWEAPON.setShouldAllowNull(true);
- table.addField(fieldWEAPON);
-
- FieldDefinition fieldVERSION = new FieldDefinition();
- fieldVERSION.setName("VERSION");
- fieldVERSION.setTypeName("NUMERIC");
- fieldVERSION.setSize(15);
- fieldVERSION.setShouldAllowNull(true);
- fieldVERSION.setIsPrimaryKey(false);
- fieldVERSION.setUnique(false);
- fieldVERSION.setIsIdentity(false);
- table.addField(fieldVERSION);
-
- return table;
- }
-
- public TableDefinition buildSPECIALASSASSINTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_SPECIAL_ASSASSIN");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldWEAPON = new FieldDefinition();
- fieldWEAPON.setName("WEAPON_ID");
- fieldWEAPON.setTypeName("NUMBER");
- fieldWEAPON.setSize(10);
- fieldWEAPON.setIsPrimaryKey(false);
- fieldWEAPON.setIsIdentity(false);
- fieldWEAPON.setUnique(false);
- fieldWEAPON.setShouldAllowNull(true);
- table.addField(fieldWEAPON);
-
- FieldDefinition fieldVERSION = new FieldDefinition();
- fieldVERSION.setName("SP_VERSION");
- fieldVERSION.setTypeName("NUMERIC");
- fieldVERSION.setSize(15);
- fieldVERSION.setShouldAllowNull(true);
- fieldVERSION.setIsPrimaryKey(false);
- fieldVERSION.setUnique(false);
- fieldVERSION.setIsIdentity(false);
- table.addField(fieldVERSION);
-
- return table;
- }
-
- public TableDefinition buildSOCIALCLUBTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_SOCIAL_CLUB");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public TableDefinition buildPERSONELCLUBTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_PERSONEL_CLUB");
-
- FieldDefinition fieldPERSONELID = new FieldDefinition();
- fieldPERSONELID.setName("PERSONEL_ID");
- fieldPERSONELID.setTypeName("NUMERIC");
- fieldPERSONELID.setSize(10);
- fieldPERSONELID.setShouldAllowNull(false);
- fieldPERSONELID.setIsPrimaryKey(true);
- fieldPERSONELID.setUnique(false);
- fieldPERSONELID.setIsIdentity(false);
- // Can't set foreign key field constraints.
- //fieldPERSONELID.setForeignKeyFieldName("CMP3_PERSONEL.ID");
- table.addField(fieldPERSONELID);
-
- FieldDefinition fieldCLUBID = new FieldDefinition();
- fieldCLUBID.setName("CLUB_ID");
- fieldCLUBID.setTypeName("NUMERIC");
- fieldCLUBID.setSize(10);
- fieldCLUBID.setShouldAllowNull(false);
- fieldCLUBID.setIsPrimaryKey(true);
- fieldCLUBID.setUnique(false);
- fieldCLUBID.setIsIdentity(false);
- // Can't set foreign key field constraints.
- //fieldCLUBID.setForeignKeyFieldName("CMP3_SOCIAL_CLUB.ID");
- table.addField(fieldCLUBID);
-
- return table;
- }
-
- public TableDefinition buildNICKNAMESTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_NICKNAMES");
-
- FieldDefinition fieldPERSONELID = new FieldDefinition();
- fieldPERSONELID.setName("PERSONEL_ID");
- fieldPERSONELID.setTypeName("NUMERIC");
- fieldPERSONELID.setSize(10);
- fieldPERSONELID.setShouldAllowNull(false);
- fieldPERSONELID.setIsPrimaryKey(true);
- fieldPERSONELID.setUnique(false);
- fieldPERSONELID.setIsIdentity(false);
- // Can't set foreign key field constraints.
- //fieldPERSONELID.setForeignKeyFieldName("CMP3_PERSONEL.ID");
- table.addField(fieldPERSONELID);
-
- FieldDefinition fieldNICKNAME = new FieldDefinition();
- fieldNICKNAME.setName("NICKNAME");
- fieldNICKNAME.setTypeName("VARCHAR");
- fieldNICKNAME.setSize(50);
- fieldNICKNAME.setShouldAllowNull(false);
- fieldNICKNAME.setIsPrimaryKey(true);
- fieldNICKNAME.setUnique(false);
- fieldNICKNAME.setIsIdentity(false);
- table.addField(fieldNICKNAME);
-
- return table;
- }
-
- public TableDefinition buildSMALLASSIGNMENTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("TPC_SMALL_ASSIGNMENT");
-
- FieldDefinition fieldSMALLID = new FieldDefinition();
- fieldSMALLID.setName("SMALL_ID");
- fieldSMALLID.setTypeName("NUMERIC");
- fieldSMALLID.setSize(10);
- fieldSMALLID.setShouldAllowNull(false);
- fieldSMALLID.setIsPrimaryKey(true);
- fieldSMALLID.setUnique(false);
- fieldSMALLID.setIsIdentity(false);
- table.addField(fieldSMALLID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(50);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- return table;
- }
-
- public TableDefinition buildCMP3_SEEDED_FRUITTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_SEEDED_FRUIT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(255);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldCLASS_TYPE = new FieldDefinition();
- fieldCLASS_TYPE.setName("CLASS_TYPE");
- fieldCLASS_TYPE.setTypeName("VARCHAR");
- fieldCLASS_TYPE.setSize(1);
- fieldCLASS_TYPE.setIsPrimaryKey(false);
- fieldCLASS_TYPE.setIsIdentity(false);
- fieldCLASS_TYPE.setUnique(false);
- fieldCLASS_TYPE.setShouldAllowNull(true);
- table.addField(fieldCLASS_TYPE);
-
- return table;
- }
-
- public TableDefinition buildCMP3_CITRUS_FRUITTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_CITRUS_FRUIT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- fieldID.setForeignKeyFieldName("CMP3_SEEDED_FRUIT.ID");
- table.addField(fieldID);
-
- FieldDefinition fieldGRADE = new FieldDefinition();
- fieldGRADE.setName("GRADE");
- fieldGRADE.setTypeName("NUMBER");
- fieldGRADE.setSize(10);
- fieldGRADE.setIsPrimaryKey(false);
- fieldGRADE.setIsIdentity(false);
- fieldGRADE.setUnique(false);
- fieldGRADE.setShouldAllowNull(true);
- table.addField(fieldGRADE);
-
- return table;
- }
-
- public TableDefinition buildCMP3_SEEDTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_SEED");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMBER");
- fieldID.setSize(10);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(false);
- fieldID.setUnique(false);
- fieldID.setShouldAllowNull(false);
- table.addField(fieldID);
-
- FieldDefinition fieldNAME = new FieldDefinition();
- fieldNAME.setName("NAME");
- fieldNAME.setTypeName("VARCHAR");
- fieldNAME.setSize(64);
- fieldNAME.setIsPrimaryKey(false);
- fieldNAME.setIsIdentity(false);
- fieldNAME.setUnique(false);
- fieldNAME.setShouldAllowNull(true);
- table.addField(fieldNAME);
-
- FieldDefinition fieldSEEDEDFRUIT_ID = new FieldDefinition();
- fieldSEEDEDFRUIT_ID.setName("SEEDEDFRUIT_ID");
- fieldSEEDEDFRUIT_ID.setTypeName("NUMBER");
- fieldSEEDEDFRUIT_ID.setSize(10);
- fieldSEEDEDFRUIT_ID.setIsPrimaryKey(false);
- fieldSEEDEDFRUIT_ID.setIsIdentity(false);
- fieldSEEDEDFRUIT_ID.setUnique(false);
- fieldSEEDEDFRUIT_ID.setShouldAllowNull(true);
- fieldSEEDEDFRUIT_ID.setForeignKeyFieldName("CMP3_SEEDED_FRUIT.ID");
- table.addField(fieldSEEDEDFRUIT_ID);
-
- return table;
- }
-
- /**
- * Dropping old foreign keys from schema change.
- */
- public void replaceTables(DatabaseSession session) {
- try {
- if (session.getPlatform().supportsUniqueKeyConstraints()
- && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
- session.executeNonSelectingSQL("Alter table CMP3_ENGINEER_LAPTOP drop constraint CMP3_ENGINEER_LAPTOP_FK1");
- }
- } catch (Exception ignore) {}
- super.replaceTables(session);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ * 02/20/2009-1.1 Guy Pelletier
+ * - 259829: TABLE_PER_CLASS with abstract classes does not work
+ * 12/18/2009-2.1 Guy Pelletier
+ * - 211323: Add class extractor support to the EclipseLink-ORM.XML Schema
+ * 01/26/2011-2.3 Guy Pelletier
+ * - 307664: Lifecycle callbacks not called for object from IndirectSet
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.jpa.inheritance;
+
+import org.eclipse.persistence.sessions.DatabaseSession;
+import org.eclipse.persistence.testing.framework.TogglingFastTableCreator;
+import org.eclipse.persistence.tools.schemaframework.*;
+
+/**
+ * This class was generated by the TopLink table creator generator.
+ * It stores the meta-data (tables) that define the database schema.
+ * @see org.eclipse.persistence.sessions.factories.TableCreatorClassGenerator
+ */
+public class InheritanceTableCreator extends TogglingFastTableCreator {
+ public InheritanceTableCreator() {
+ setName("EJB3InheritanceProject");
+
+ addTableDefinition(buildBICYCLETable());
+ addTableDefinition(buildBOATTable());
+ addTableDefinition(buildBUS_TIRETable());
+ addTableDefinition(buildBUSTable());
+ addTableDefinition(buildCOMPANYTable());
+ addTableDefinition(buildFUEL_VEHTable());
+ addTableDefinition(buildNONFUEL_VEHTable());
+ addTableDefinition(buildSPORTSCARTable());
+ addTableDefinition(buildJALOPYTable());
+ addTableDefinition(buildVEHICLETable());
+ addTableDefinition(buildVEHICLE_DIRECTORYTable());
+ addTableDefinition(buildPERSONTable());
+ addTableDefinition(buildENGINEERTable());
+ addTableDefinition(buildTIREINFOTable());
+ addTableDefinition(buildOFFROADTIREINFOTable());
+ addTableDefinition(buildMUDTIREINFOTable());
+ addTableDefinition(buildTIRERATINGCOMMENTTable());
+ addTableDefinition(buildROCKTIREINFOTable());
+ addTableDefinition(buildAAATable());
+ addTableDefinition(buildAAA_STRINGSETTable());
+ addTableDefinition(buildBBBTable());
+ addTableDefinition(buildCCCTable());
+ addTableDefinition(buildDDDTable());
+ addTableDefinition(buildCOMPUTERTable());
+ addTableDefinition(buildDESKTOPTable());
+ addTableDefinition(buildENGINEER_DESKTOPTable());
+ addTableDefinition(buildLAPTOPTable());
+ addTableDefinition(buildENGINEER_LAPTOPTable());
+
+ // Table per class testing, all tables prefixed with TPC_
+ addTableDefinition(buildWEAPONTable());
+ addTableDefinition(buildDIRECTWEAPONTable());
+ addTableDefinition(buildINDIRECTWEAPONTable());
+ addTableDefinition(buildGUNTable());
+ addTableDefinition(buildKNIFETable());
+ addTableDefinition(buildPOISONTable());
+ addTableDefinition(buildBOMBTable());
+ addTableDefinition(buildELIMINATIONTable());
+ addTableDefinition(buildDIRECTELIMINATIONTable());
+ addTableDefinition(buildINDIRECTELIMINATIONTable());
+ addTableDefinition(buildCONTRACTEDPERSONELTable());
+ addTableDefinition(buildASSASSINTable());
+ addTableDefinition(buildSPECIALASSASSINTable());
+ addTableDefinition(buildSOCIALCLUBTable());
+ addTableDefinition(buildPERSONELCLUBTable());
+ addTableDefinition(buildSMALLASSIGNMENTTable());
+ addTableDefinition(buildNICKNAMESTable());
+
+ addTableDefinition(buildAPPLETable());
+ addTableDefinition(buildMACBOOKTable());
+ addTableDefinition(buildMACBOOKPROTable());
+
+ // bug 396587
+ addTableDefinition(buildTPC_SUPERCLASSTable());
+ addTableDefinition(buildTPC_SUBCLASSTable());
+ addTableDefinition(buildJOINED_SUPERCLASSTable());
+ addTableDefinition(buildJOINED_SUBCLASSTable());
+ addTableDefinition(buildSTI_SUPERCLASSTable());
+
+ // Bug 404071
+ addTableDefinition(buildCMP3_SEEDTable());
+ addTableDefinition(buildCMP3_SEEDED_FRUITTable());
+ addTableDefinition(buildCMP3_CITRUS_FRUITTable());
+ }
+
+ public TableDefinition buildSTI_SUPERCLASSTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_STI_SUPERCLASS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldCLASSTYPE = new FieldDefinition();
+ fieldCLASSTYPE.setName("CLASSTYPE");
+ fieldCLASSTYPE.setTypeName("VARCHAR2");
+ fieldCLASSTYPE.setSize(3);
+ fieldCLASSTYPE.setSubSize(0);
+ fieldCLASSTYPE.setIsPrimaryKey(false);
+ fieldCLASSTYPE.setIsIdentity(false);
+ fieldCLASSTYPE.setUnique(false);
+ fieldCLASSTYPE.setShouldAllowNull(false);
+ table.addField(fieldCLASSTYPE);
+
+ FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
+ fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUPERCLASS_ATTRIBUTE.setSize(64);
+ fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
+ table.addField(fieldSUPERCLASS_ATTRIBUTE);
+
+ FieldDefinition fieldSUBCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUBCLASS_ATTRIBUTE.setName("SUBCLASS_ATTRIBUTE");
+ fieldSUBCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUBCLASS_ATTRIBUTE.setSize(64);
+ fieldSUBCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUBCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUBCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUBCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUBCLASS_ATTRIBUTE.setShouldAllowNull(true);
+ table.addField(fieldSUBCLASS_ATTRIBUTE);
+
+ return table;
+ }
+
+ public TableDefinition buildJOINED_SUPERCLASSTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_JOINED_SUPERCLASS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldCLASSTYPE = new FieldDefinition();
+ fieldCLASSTYPE.setName("CLASSTYPE");
+ fieldCLASSTYPE.setTypeName("VARCHAR2");
+ fieldCLASSTYPE.setSize(3);
+ fieldCLASSTYPE.setSubSize(0);
+ fieldCLASSTYPE.setIsPrimaryKey(false);
+ fieldCLASSTYPE.setIsIdentity(false);
+ fieldCLASSTYPE.setUnique(false);
+ fieldCLASSTYPE.setShouldAllowNull(false);
+ table.addField(fieldCLASSTYPE);
+
+ FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
+ fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUPERCLASS_ATTRIBUTE.setSize(64);
+ fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
+ table.addField(fieldSUPERCLASS_ATTRIBUTE);
+
+ return table;
+ }
+
+ public TableDefinition buildJOINED_SUBCLASSTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_JOINED_SUBCLASS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSUBCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUBCLASS_ATTRIBUTE.setName("SUBCLASS_ATTRIBUTE");
+ fieldSUBCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUBCLASS_ATTRIBUTE.setSize(64);
+ fieldSUBCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUBCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUBCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUBCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUBCLASS_ATTRIBUTE.setShouldAllowNull(true);
+ table.addField(fieldSUBCLASS_ATTRIBUTE);
+
+ ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
+ fkConstraint.setName("JPA_JOINED_SUBCLASS_FK1");
+ fkConstraint.setTargetTable("JPA_JOINED_SUPERCLASS");
+ fkConstraint.addSourceField("ID");
+ fkConstraint.addTargetField("ID");
+ table.addForeignKeyConstraint(fkConstraint);
+
+ return table;
+ }
+
+ public TableDefinition buildTPC_SUPERCLASSTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_TPC_SUPERCLASS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
+ fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUPERCLASS_ATTRIBUTE.setSize(64);
+ fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
+ table.addField(fieldSUPERCLASS_ATTRIBUTE);
+
+ return table;
+ }
+
+ public TableDefinition buildTPC_SUBCLASSTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_TPC_SUBCLASS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSUPERCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUPERCLASS_ATTRIBUTE.setName("SUPERCLASS_ATTRIBUTE");
+ fieldSUPERCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUPERCLASS_ATTRIBUTE.setSize(64);
+ fieldSUPERCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUPERCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUPERCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUPERCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUPERCLASS_ATTRIBUTE.setShouldAllowNull(false);
+ table.addField(fieldSUPERCLASS_ATTRIBUTE);
+
+ FieldDefinition fieldSUBCLASS_ATTRIBUTE = new FieldDefinition();
+ fieldSUBCLASS_ATTRIBUTE.setName("SUBCLASS_ATTRIBUTE");
+ fieldSUBCLASS_ATTRIBUTE.setTypeName("VARCHAR2");
+ fieldSUBCLASS_ATTRIBUTE.setSize(64);
+ fieldSUBCLASS_ATTRIBUTE.setSubSize(0);
+ fieldSUBCLASS_ATTRIBUTE.setIsPrimaryKey(false);
+ fieldSUBCLASS_ATTRIBUTE.setIsIdentity(false);
+ fieldSUBCLASS_ATTRIBUTE.setUnique(false);
+ fieldSUBCLASS_ATTRIBUTE.setShouldAllowNull(true);
+ table.addField(fieldSUBCLASS_ATTRIBUTE);
+
+ return table;
+ }
+
+ public TableDefinition buildAPPLETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_APPLE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public TableDefinition buildMACBOOKTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_MACBOOK");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("JPA_APPLE.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldRAM = new FieldDefinition();
+ fieldRAM.setName("RAM");
+ fieldRAM.setTypeName("NUMBER");
+ fieldRAM.setSize(10);
+ fieldRAM.setSubSize(0);
+ fieldRAM.setIsPrimaryKey(false);
+ fieldRAM.setIsIdentity(false);
+ fieldRAM.setUnique(false);
+ fieldRAM.setShouldAllowNull(true);
+ table.addField(fieldRAM);
+
+ return table;
+ }
+
+ public TableDefinition buildMACBOOKPROTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_MACBOOK_PRO");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("JPA_MACBOOK.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldCOLOR = new FieldDefinition();
+ fieldCOLOR.setName("COLOR");
+ fieldCOLOR.setTypeName("VARCHAR2");
+ fieldCOLOR.setSize(10);
+ fieldCOLOR.setSubSize(0);
+ fieldCOLOR.setIsPrimaryKey(false);
+ fieldCOLOR.setIsIdentity(false);
+ fieldCOLOR.setUnique(false);
+ fieldCOLOR.setShouldAllowNull(true);
+ table.addField(fieldCOLOR);
+
+ return table;
+ }
+
+ public TableDefinition buildBICYCLETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_BICYCLE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_NONFUEL_VEH.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR2");
+ fieldDESCRIP.setSize(10);
+ fieldDESCRIP.setSubSize(0);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ return table;
+ }
+
+ public TableDefinition buildBOATTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_BOAT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("BOAT_ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_NONFUEL_VEH.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldMODEL = new FieldDefinition();
+ fieldMODEL.setName("MODEL");
+ fieldMODEL.setTypeName("VARCHAR2");
+ fieldMODEL.setSize(10);
+ fieldMODEL.setSubSize(0);
+ fieldMODEL.setIsPrimaryKey(false);
+ fieldMODEL.setIsIdentity(false);
+ fieldMODEL.setUnique(false);
+ fieldMODEL.setShouldAllowNull(true);
+ table.addField(fieldMODEL);
+
+ return table;
+ }
+
+ public TableDefinition buildBUS_TIRETable(){
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_BUS_CMP3_TIRE");
+
+ FieldDefinition fieldBusID = new FieldDefinition();
+ fieldBusID.setName("Bus_ID");
+ fieldBusID.setTypeName("NUMBER");
+ fieldBusID.setSize(15);
+ fieldBusID.setSubSize(0);
+ fieldBusID.setIsPrimaryKey(true);
+ fieldBusID.setIsIdentity(false);
+ fieldBusID.setUnique(false);
+ fieldBusID.setShouldAllowNull(false);
+ fieldBusID.setForeignKeyFieldName("CMP3_BUS.BUS_ID");
+ table.addField(fieldBusID);
+
+ FieldDefinition fieldTireID = new FieldDefinition();
+ fieldTireID.setName("tires_ID");
+ fieldTireID.setTypeName("NUMBER");
+ fieldTireID.setSize(15);
+ fieldTireID.setSubSize(0);
+ fieldTireID.setIsPrimaryKey(true);
+ fieldTireID.setIsIdentity(false);
+ fieldTireID.setUnique(false);
+ fieldTireID.setShouldAllowNull(false);
+ fieldTireID.setForeignKeyFieldName("CMP3_TIRE.ID");
+ table.addField(fieldTireID);
+
+ return table;
+ }
+
+ public TableDefinition buildBUSTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_BUS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("BUS_ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_FUEL_VEH.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldDRIVER_ID = new FieldDefinition();
+ fieldDRIVER_ID.setName("DRIVER_ID");
+ fieldDRIVER_ID.setTypeName("NUMBER");
+ fieldDRIVER_ID.setSize(15);
+ fieldDRIVER_ID.setSubSize(0);
+ fieldDRIVER_ID.setIsPrimaryKey(false);
+ fieldDRIVER_ID.setIsIdentity(false);
+ fieldDRIVER_ID.setUnique(false);
+ fieldDRIVER_ID.setShouldAllowNull(true);
+ table.addField(fieldDRIVER_ID);
+
+ ForeignKeyConstraint foreignKeyBUS_PERSON = new ForeignKeyConstraint();
+ foreignKeyBUS_PERSON.setName("BUSDRIVER_ID");
+ foreignKeyBUS_PERSON.setTargetTable("CMP3_PERSON");
+ foreignKeyBUS_PERSON.addSourceField("DRIVER_ID");
+ foreignKeyBUS_PERSON.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyBUS_PERSON);
+
+ return table;
+ }
+
+ public TableDefinition buildROCKTIREINFOTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ROCK_TIRE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_OFFROAD_TIRE.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldGRIP = new FieldDefinition();
+ fieldGRIP.setName("GRIP");
+ fieldGRIP.setTypeName("NUMBER");
+ fieldGRIP.setSize(15);
+ fieldGRIP.setSubSize(0);
+ fieldGRIP.setIsPrimaryKey(false);
+ fieldGRIP.setIsIdentity(false);
+ fieldGRIP.setUnique(false);
+ fieldGRIP.setShouldAllowNull(true);
+ table.addField(fieldGRIP);
+
+ return table;
+ }
+
+ public TableDefinition buildSPORTSCARTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_SPORTS_CAR");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_FUEL_VEH.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldFUEL_CAP = new FieldDefinition();
+ fieldFUEL_CAP.setName("MAX_SPEED");
+ fieldFUEL_CAP.setTypeName("NUMBER");
+ fieldFUEL_CAP.setSize(10);
+ fieldFUEL_CAP.setSubSize(0);
+ fieldFUEL_CAP.setIsPrimaryKey(false);
+ fieldFUEL_CAP.setIsIdentity(false);
+ fieldFUEL_CAP.setUnique(false);
+ fieldFUEL_CAP.setShouldAllowNull(true);
+ table.addField(fieldFUEL_CAP);
+
+ return table;
+ }
+
+ public TableDefinition buildJALOPYTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_JALOPY");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_FUEL_VEH.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldRUST = new FieldDefinition();
+ fieldRUST.setName("PERCENTRUST");
+ fieldRUST.setTypeName("NUMBER");
+ fieldRUST.setSize(10);
+ fieldRUST.setSubSize(0);
+ fieldRUST.setIsPrimaryKey(false);
+ fieldRUST.setIsIdentity(false);
+ fieldRUST.setUnique(false);
+ fieldRUST.setShouldAllowNull(true);
+ table.addField(fieldRUST);
+
+ return table;
+ }
+ public TableDefinition buildCOMPANYTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_COMPANY");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(100);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(false);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public TableDefinition buildFUEL_VEHTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_FUEL_VEH");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_VEHICLE.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR2");
+ fieldDESCRIP.setSize(30);
+ fieldDESCRIP.setSubSize(0);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldFUEL_CAP = new FieldDefinition();
+ fieldFUEL_CAP.setName("FUEL_CAP");
+ fieldFUEL_CAP.setTypeName("NUMBER");
+ fieldFUEL_CAP.setSize(10);
+ fieldFUEL_CAP.setSubSize(0);
+ fieldFUEL_CAP.setIsPrimaryKey(false);
+ fieldFUEL_CAP.setIsIdentity(false);
+ fieldFUEL_CAP.setUnique(false);
+ fieldFUEL_CAP.setShouldAllowNull(true);
+ table.addField(fieldFUEL_CAP);
+
+ FieldDefinition fieldFUEL_TYP = new FieldDefinition();
+ fieldFUEL_TYP.setName("FUEL_TYP");
+ fieldFUEL_TYP.setTypeName("VARCHAR2");
+ fieldFUEL_TYP.setSize(30);
+ fieldFUEL_TYP.setSubSize(0);
+ fieldFUEL_TYP.setIsPrimaryKey(false);
+ fieldFUEL_TYP.setIsIdentity(false);
+ fieldFUEL_TYP.setUnique(false);
+ fieldFUEL_TYP.setShouldAllowNull(true);
+ table.addField(fieldFUEL_TYP);
+
+ FieldDefinition fieldCOLOUR = new FieldDefinition();
+ fieldCOLOUR.setName("COLOUR");
+ fieldCOLOUR.setTypeName("VARCHAR2");
+ fieldCOLOUR.setSize(20);
+ fieldCOLOUR.setSubSize(0);
+ fieldCOLOUR.setIsPrimaryKey(false);
+ fieldCOLOUR.setIsIdentity(false);
+ fieldCOLOUR.setUnique(false);
+ fieldCOLOUR.setShouldAllowNull(true);
+ table.addField(fieldCOLOUR);
+
+ return table;
+ }
+
+ public TableDefinition buildMUDTIREINFOTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_MUD_TIRE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_OFFROAD_TIRE.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldTREAD = new FieldDefinition();
+ fieldTREAD.setName("TREAD_DEPTH");
+ fieldTREAD.setTypeName("NUMBER");
+ fieldTREAD.setSize(15);
+ fieldTREAD.setSubSize(0);
+ fieldTREAD.setIsPrimaryKey(false);
+ fieldTREAD.setIsIdentity(false);
+ fieldTREAD.setUnique(false);
+ fieldTREAD.setShouldAllowNull(true);
+ table.addField(fieldTREAD);
+
+ FieldDefinition fieldRATING = new FieldDefinition();
+ fieldRATING.setName("RATING");
+ fieldRATING.setTypeName("VARCHAR2");
+ fieldRATING.setSize(20);
+ fieldRATING.setSubSize(0);
+ fieldRATING.setIsPrimaryKey(false);
+ fieldRATING.setIsIdentity(false);
+ fieldRATING.setUnique(false);
+ fieldRATING.setShouldAllowNull(true);
+ table.addField(fieldRATING);
+
+ FieldDefinition fieldCOMMENT = new FieldDefinition();
+ fieldCOMMENT.setName("COMMENT_ID");
+ fieldCOMMENT.setTypeName("NUMBER");
+ fieldCOMMENT.setSize(15);
+ fieldCOMMENT.setSubSize(0);
+ fieldCOMMENT.setShouldAllowNull(true);
+ fieldCOMMENT.setIsPrimaryKey(false);
+ fieldCOMMENT.setIsIdentity(false);
+ fieldCOMMENT.setUnique(false);
+ fieldCOMMENT.setForeignKeyFieldName("CMP3_TIRE_RATING_COMMENT.ID");
+ table.addField(fieldCOMMENT);
+
+ return table;
+ }
+
+ public TableDefinition buildTIRERATINGCOMMENTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_TIRE_RATING_COMMENT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR2");
+ fieldDESCRIP.setSize(100);
+ fieldDESCRIP.setSubSize(0);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ return table;
+ }
+
+ public TableDefinition buildNONFUEL_VEHTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_NONFUEL_VEH");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_VEHICLE.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldCOLOR = new FieldDefinition();
+ fieldCOLOR.setName("COLOR");
+ fieldCOLOR.setTypeName("VARCHAR2");
+ fieldCOLOR.setSize(20);
+ fieldCOLOR.setSubSize(0);
+ fieldCOLOR.setIsPrimaryKey(false);
+ fieldCOLOR.setIsIdentity(false);
+ fieldCOLOR.setUnique(false);
+ fieldCOLOR.setShouldAllowNull(true);
+ table.addField(fieldCOLOR);
+
+ return table;
+ }
+
+ public TableDefinition buildENGINEERTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_ENGINEER");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_PERSON.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldTITLE = new FieldDefinition();
+ fieldTITLE.setName("TITLE");
+ fieldTITLE.setTypeName("VARCHAR2");
+ fieldTITLE.setSize(26);
+ fieldTITLE.setSubSize(0);
+ fieldTITLE.setIsPrimaryKey(false);
+ fieldTITLE.setIsIdentity(false);
+ fieldTITLE.setUnique(false);
+ fieldTITLE.setShouldAllowNull(true);
+ table.addField(fieldTITLE);
+
+ FieldDefinition fieldCOMPANY_ID = new FieldDefinition();
+ fieldCOMPANY_ID.setName("COMPANY_ID");
+ fieldCOMPANY_ID.setTypeName("NUMBER");
+ fieldCOMPANY_ID.setSize(15);
+ fieldCOMPANY_ID.setSubSize(0);
+ fieldCOMPANY_ID.setIsPrimaryKey(false);
+ fieldCOMPANY_ID.setIsIdentity(false);
+ fieldCOMPANY_ID.setUnique(false);
+ fieldCOMPANY_ID.setShouldAllowNull(true);
+ fieldCOMPANY_ID.setForeignKeyFieldName("CMP3_COMPANY.ID");
+ table.addField(fieldCOMPANY_ID);
+
+ return table;
+ }
+
+ public TableDefinition buildOFFROADTIREINFOTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_OFFROAD_TIRE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_TIRE.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(25);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldCODE = new FieldDefinition();
+ fieldCODE.setName("CODE");
+ fieldCODE.setTypeName("VARCHAR2");
+ fieldCODE.setSize(20);
+ fieldCODE.setSubSize(0);
+ fieldCODE.setIsPrimaryKey(false);
+ fieldCODE.setIsIdentity(false);
+ fieldCODE.setUnique(false);
+ fieldCODE.setShouldAllowNull(true);
+ table.addField(fieldCODE);
+
+ FieldDefinition fieldDTYPE = new FieldDefinition();
+ fieldDTYPE.setName("DTYPE");
+ fieldDTYPE.setTypeName("VARCHAR2");
+ fieldDTYPE.setSize(15);
+ fieldDTYPE.setSubSize(0);
+ fieldDTYPE.setIsPrimaryKey(false);
+ fieldDTYPE.setIsIdentity(false);
+ fieldDTYPE.setUnique(false);
+ fieldDTYPE.setShouldAllowNull(true);
+ table.addField(fieldDTYPE);
+
+ return table;
+ }
+
+ public TableDefinition buildPERSONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PERSON");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(20);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldC_TYPE = new FieldDefinition();
+ fieldC_TYPE.setName("DTYPE");
+ fieldC_TYPE.setTypeName("NUMBER");
+ fieldC_TYPE.setSize(15);
+ fieldC_TYPE.setSubSize(0);
+ fieldC_TYPE.setIsPrimaryKey(false);
+ fieldC_TYPE.setIsIdentity(false);
+ fieldC_TYPE.setUnique(false);
+ fieldC_TYPE.setShouldAllowNull(true);
+ table.addField(fieldC_TYPE);
+
+ FieldDefinition fieldREP_ID = new FieldDefinition();
+ fieldREP_ID.setName("REP_ID");
+ fieldREP_ID.setTypeName("NUMBER");
+ fieldREP_ID.setSize(15);
+ fieldREP_ID.setSubSize(0);
+ fieldREP_ID.setIsPrimaryKey(false);
+ fieldREP_ID.setIsIdentity(false);
+ fieldREP_ID.setUnique(false);
+ fieldREP_ID.setShouldAllowNull(true);
+ table.addField(fieldREP_ID);
+
+ FieldDefinition fieldFRIEND_ID = new FieldDefinition();
+ fieldFRIEND_ID.setName("FRIEND_ID");
+ fieldFRIEND_ID.setTypeName("NUMBER");
+ fieldFRIEND_ID.setSize(15);
+ fieldFRIEND_ID.setSubSize(0);
+ fieldFRIEND_ID.setIsPrimaryKey(false);
+ fieldFRIEND_ID.setIsIdentity(false);
+ fieldFRIEND_ID.setUnique(false);
+ fieldFRIEND_ID.setShouldAllowNull(true);
+ table.addField(fieldFRIEND_ID);
+
+ FieldDefinition fieldCAR_ID = new FieldDefinition();
+ fieldCAR_ID.setName("CAR_ID");
+ fieldCAR_ID.setTypeName("NUMBER");
+ fieldCAR_ID.setSize(15);
+ fieldCAR_ID.setSubSize(0);
+ fieldCAR_ID.setIsPrimaryKey(false);
+ fieldCAR_ID.setIsIdentity(false);
+ fieldCAR_ID.setUnique(false);
+ fieldCAR_ID.setShouldAllowNull(true);
+ table.addField(fieldCAR_ID);
+
+ ForeignKeyConstraint foreignKeyPERSON_CAR = new ForeignKeyConstraint();
+ foreignKeyPERSON_CAR.setName("PERSON_CAR");
+ foreignKeyPERSON_CAR.setTargetTable("CMP3_VEHICLE");
+ foreignKeyPERSON_CAR.addSourceField("CAR_ID");
+ foreignKeyPERSON_CAR.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyPERSON_CAR);
+
+ ForeignKeyConstraint foreignKeyPERSON_ENGINEER = new ForeignKeyConstraint();
+ foreignKeyPERSON_ENGINEER.setName("PERSON_ENGINEER");
+ foreignKeyPERSON_ENGINEER.setTargetTable("CMP3_ENGINEER");
+ foreignKeyPERSON_ENGINEER.addSourceField("FRIEND_ID");
+ foreignKeyPERSON_ENGINEER.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyPERSON_ENGINEER);
+
+ ForeignKeyConstraint foreignKeyPERSON_REP = new ForeignKeyConstraint();
+ foreignKeyPERSON_REP.setName("PERSON_LAWYER");
+ foreignKeyPERSON_REP.setTargetTable("CMP3_PERSON");
+ foreignKeyPERSON_REP.addSourceField("REP_ID");
+ foreignKeyPERSON_REP.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyPERSON_REP);
+
+ return table;
+ }
+
+ public TableDefinition buildVEHICLETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_VEHICLE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldTYPE = new FieldDefinition();
+ fieldTYPE.setName("VEH_TYPE");
+ fieldTYPE.setTypeName("VARCHAR2");
+ fieldTYPE.setSize(15);
+ fieldTYPE.setSubSize(0);
+ fieldTYPE.setIsPrimaryKey(false);
+ fieldTYPE.setIsIdentity(false);
+ fieldTYPE.setUnique(false);
+ fieldTYPE.setShouldAllowNull(true);
+ table.addField(fieldTYPE);
+
+ FieldDefinition fieldCAPACITY = new FieldDefinition();
+ fieldCAPACITY.setName("CAPACITY");
+ fieldCAPACITY.setTypeName("NUMBER");
+ fieldCAPACITY.setSize(10);
+ fieldCAPACITY.setSubSize(0);
+ fieldCAPACITY.setIsPrimaryKey(false);
+ fieldCAPACITY.setIsIdentity(false);
+ fieldCAPACITY.setUnique(false);
+ fieldCAPACITY.setShouldAllowNull(true);
+ table.addField(fieldCAPACITY);
+
+ FieldDefinition fieldOWNER_ID = new FieldDefinition();
+ fieldOWNER_ID.setName("OWNER_ID");
+ fieldOWNER_ID.setTypeName("NUMBER");
+ fieldOWNER_ID.setSize(15);
+ fieldOWNER_ID.setSubSize(0);
+ fieldOWNER_ID.setIsPrimaryKey(false);
+ fieldOWNER_ID.setIsIdentity(false);
+ fieldOWNER_ID.setUnique(false);
+ fieldOWNER_ID.setShouldAllowNull(true);
+ table.addField(fieldOWNER_ID);
+
+ FieldDefinition fieldDIRECTORY_ID = new FieldDefinition();
+ fieldDIRECTORY_ID.setName("DIRECTORY_ID");
+ fieldDIRECTORY_ID.setTypeName("NUMBER");
+ fieldDIRECTORY_ID.setSize(15);
+ fieldDIRECTORY_ID.setSubSize(0);
+ fieldDIRECTORY_ID.setIsPrimaryKey(false);
+ fieldDIRECTORY_ID.setIsIdentity(false);
+ fieldDIRECTORY_ID.setUnique(false);
+ fieldDIRECTORY_ID.setShouldAllowNull(true);
+ table.addField(fieldDIRECTORY_ID);
+
+ ForeignKeyConstraint foreignKeyVEHICLE_COMPANY = new ForeignKeyConstraint();
+ foreignKeyVEHICLE_COMPANY.setName("VEHICLE_COMPANY_FK");
+ foreignKeyVEHICLE_COMPANY.setTargetTable("CMP3_COMPANY");
+ foreignKeyVEHICLE_COMPANY.addSourceField("OWNER_ID");
+ foreignKeyVEHICLE_COMPANY.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyVEHICLE_COMPANY);
+
+ ForeignKeyConstraint foreignKeyVEHICLE_DIRECTORY = new ForeignKeyConstraint();
+ foreignKeyVEHICLE_DIRECTORY.setName("VEHICLE_DIRECTORY_FK");
+ foreignKeyVEHICLE_DIRECTORY.setTargetTable("CMP3_VEHICLE_DIRECTORY");
+ foreignKeyVEHICLE_DIRECTORY.addSourceField("DIRECTORY_ID");
+ foreignKeyVEHICLE_DIRECTORY.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyVEHICLE_DIRECTORY);
+
+
+ return table;
+ }
+
+ public TableDefinition buildVEHICLE_DIRECTORYTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_VEHICLE_DIRECTORY");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR2");
+ fieldNAME.setSize(15);
+ fieldNAME.setSubSize(0);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public TableDefinition buildTIREINFOTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_TIRE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ fieldID = new FieldDefinition();
+ fieldID.setName("PRESSURE");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(false);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(true);
+ table.addField(fieldID);
+
+ fieldID = new FieldDefinition();
+ fieldID.setName("SPEEDRATING");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(false);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(true);
+ table.addField(fieldID);
+
+ FieldDefinition fieldTYPE = new FieldDefinition();
+ fieldTYPE.setName("TIRE_TYPE");
+ fieldTYPE.setTypeName("VARCHAR2");
+ fieldTYPE.setSize(15);
+ fieldTYPE.setSubSize(0);
+ fieldTYPE.setIsPrimaryKey(false);
+ fieldTYPE.setIsIdentity(false);
+ fieldTYPE.setUnique(false);
+ fieldTYPE.setShouldAllowNull(true);
+ table.addField(fieldTYPE);
+
+ return table;
+ }
+
+ public TableDefinition buildAAATable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_AAA");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldDTYPES = new FieldDefinition();
+ fieldDTYPES.setName("DTYPES");
+ fieldDTYPES.setTypeName("VARCHAR");
+ fieldDTYPES.setSize(2);
+ fieldDTYPES.setIsPrimaryKey(false);
+ fieldDTYPES.setIsIdentity(false);
+ fieldDTYPES.setUnique(false);
+ fieldDTYPES.setShouldAllowNull(true);
+ table.addField(fieldDTYPES);
+
+ FieldDefinition fieldSTRINGDATA = new FieldDefinition();
+ fieldSTRINGDATA.setName("FOO");
+ fieldSTRINGDATA.setTypeName("VARCHAR");
+ fieldSTRINGDATA.setSize(30);
+ fieldSTRINGDATA.setIsPrimaryKey(false);
+ fieldSTRINGDATA.setIsIdentity(false);
+ fieldSTRINGDATA.setUnique(false);
+ fieldSTRINGDATA.setShouldAllowNull(true);
+ table.addField(fieldSTRINGDATA);
+
+ return table;
+ }
+
+ public static TableDefinition buildAAA_STRINGSETTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("AAA_STRINGSET");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("AAA_ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);//needed to prevent duplicates
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition DESCRIP_field = new FieldDefinition();
+ DESCRIP_field.setName("STRINGSET");
+ DESCRIP_field.setTypeName("VARCHAR");
+ DESCRIP_field.setSize(40);
+ fieldID.setIsPrimaryKey(true);//needed to prevent duplicates
+ DESCRIP_field.setIsPrimaryKey(false);
+ DESCRIP_field.setUnique(false);
+ DESCRIP_field.setIsIdentity(false);
+ table.addField(DESCRIP_field);
+
+ return table;
+ }
+
+ public TableDefinition buildBBBTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_BBB");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_AAA.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldSTRINGDATA = new FieldDefinition();
+ fieldSTRINGDATA.setName("BAR");
+ fieldSTRINGDATA.setTypeName("VARCHAR");
+ fieldSTRINGDATA.setSize(30);
+ fieldSTRINGDATA.setIsPrimaryKey(false);
+ fieldSTRINGDATA.setIsIdentity(false);
+ fieldSTRINGDATA.setUnique(false);
+ fieldSTRINGDATA.setShouldAllowNull(true);
+ table.addField(fieldSTRINGDATA);
+
+ return table;
+ }
+
+ public TableDefinition buildCCCTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_CCC");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_BBB.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldSTRINGDATA = new FieldDefinition();
+ fieldSTRINGDATA.setName("XYZ");
+ fieldSTRINGDATA.setTypeName("VARCHAR");
+ fieldSTRINGDATA.setSize(30);
+ fieldSTRINGDATA.setIsPrimaryKey(false);
+ fieldSTRINGDATA.setIsIdentity(false);
+ fieldSTRINGDATA.setUnique(false);
+ fieldSTRINGDATA.setShouldAllowNull(true);
+ table.addField(fieldSTRINGDATA);
+
+ return table;
+ }
+
+ public TableDefinition buildDDDTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_DDD");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(15);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldPOSTLOADCOUNT = new FieldDefinition();
+ fieldPOSTLOADCOUNT.setName("POST_LOAD_COUNT");
+ fieldPOSTLOADCOUNT.setTypeName("NUMBER");
+ fieldPOSTLOADCOUNT.setSize(15);
+ fieldPOSTLOADCOUNT.setSubSize(0);
+ fieldPOSTLOADCOUNT.setIsPrimaryKey(false);
+ fieldPOSTLOADCOUNT.setIsIdentity(false);
+ fieldPOSTLOADCOUNT.setUnique(false);
+ fieldPOSTLOADCOUNT.setShouldAllowNull(true);
+ table.addField(fieldPOSTLOADCOUNT);
+
+ FieldDefinition fieldELPOSTLOADCOUNT = new FieldDefinition();
+ fieldELPOSTLOADCOUNT.setName("EL_POST_LOAD_COUNT");
+ fieldELPOSTLOADCOUNT.setTypeName("NUMBER");
+ fieldELPOSTLOADCOUNT.setSize(15);
+ fieldELPOSTLOADCOUNT.setSubSize(0);
+ fieldELPOSTLOADCOUNT.setIsPrimaryKey(false);
+ fieldELPOSTLOADCOUNT.setIsIdentity(false);
+ fieldELPOSTLOADCOUNT.setUnique(false);
+ fieldELPOSTLOADCOUNT.setShouldAllowNull(true);
+ table.addField(fieldELPOSTLOADCOUNT);
+
+ FieldDefinition aaaID = new FieldDefinition();
+ aaaID.setName("AAA_ID");
+ aaaID.setTypeName("NUMBER");
+ aaaID.setSize(15);
+ aaaID.setSubSize(0);
+ aaaID.setShouldAllowNull(true);
+ aaaID.setIsPrimaryKey(false);
+ aaaID.setUnique(false);
+ aaaID.setIsIdentity(false);
+ aaaID.setForeignKeyFieldName("CMP3_AAA.ID");
+ table.addField(aaaID);
+
+ return table;
+ }
+
+ public TableDefinition buildCOMPUTERTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_COMPUTER");
+
+ FieldDefinition fieldMFR = new FieldDefinition();
+ fieldMFR.setName("MFR");
+ fieldMFR.setTypeName("VARCHAR");
+ fieldMFR.setSize(30);
+ fieldMFR.setIsPrimaryKey(true);
+ fieldMFR.setIsIdentity(false);
+ fieldMFR.setUnique(false);
+ fieldMFR.setShouldAllowNull(false);
+ table.addField(fieldMFR);
+
+ FieldDefinition fieldSNO = new FieldDefinition();
+ fieldSNO.setName("SNO");
+ fieldSNO.setTypeName("NUMBER");
+ fieldSNO.setSize(10);
+ fieldSNO.setSubSize(0);
+ fieldSNO.setIsPrimaryKey(true);
+ fieldSNO.setIsIdentity(false);
+ fieldSNO.setUnique(false);
+ fieldSNO.setShouldAllowNull(false);
+ table.addField(fieldSNO);
+
+ FieldDefinition fieldDTYPE = new FieldDefinition();
+ fieldDTYPE.setName("DTYPE");
+ fieldDTYPE.setTypeName("VARCHAR");
+ fieldDTYPE.setSize(20);
+ fieldDTYPE.setIsPrimaryKey(false);
+ fieldDTYPE.setIsIdentity(false);
+ fieldDTYPE.setUnique(false);
+ fieldDTYPE.setShouldAllowNull(true);
+ table.addField(fieldDTYPE);
+
+ return table;
+ }
+
+ public TableDefinition buildDESKTOPTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_DESKTOP");
+
+ FieldDefinition fieldMFR = new FieldDefinition();
+ fieldMFR.setName("DT_MFR");
+ fieldMFR.setTypeName("VARCHAR");
+ fieldMFR.setSize(30);
+ fieldMFR.setIsPrimaryKey(true);
+ fieldMFR.setIsIdentity(false);
+ fieldMFR.setUnique(false);
+ fieldMFR.setShouldAllowNull(false);
+ table.addField(fieldMFR);
+
+ FieldDefinition fieldSNO = new FieldDefinition();
+ fieldSNO.setName("DT_SNO");
+ fieldSNO.setTypeName("NUMBER");
+ fieldSNO.setSize(10);
+ fieldSNO.setSubSize(0);
+ fieldSNO.setIsPrimaryKey(true);
+ fieldSNO.setIsIdentity(false);
+ fieldSNO.setUnique(false);
+ fieldSNO.setShouldAllowNull(false);
+ table.addField(fieldSNO);
+
+ ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
+ fkConstraint.setName("CMP3_DESKTOP_FK");
+ fkConstraint.addSourceField("DT_MFR");
+ fkConstraint.addSourceField("DT_SNO");
+ fkConstraint.setTargetTable("CMP3_COMPUTER");
+ fkConstraint.addTargetField("MFR");
+ fkConstraint.addTargetField("SNO");
+ table.addForeignKeyConstraint(fkConstraint);
+
+ return table;
+ }
+
+ // Engineer-Desktop many-to-many relationship table
+ public TableDefinition buildENGINEER_DESKTOPTable() {
+ TableDefinition table = new TableDefinition();
+
+ table.setName("CMP3_ENGINEER_DESKTOP");
+
+ FieldDefinition fieldEngineerId = new FieldDefinition();
+ fieldEngineerId.setName("ENGINEER_ID");
+ fieldEngineerId.setTypeName("NUMBER");
+ fieldEngineerId.setSize(15);
+ fieldEngineerId.setSubSize(0);
+ fieldEngineerId.setShouldAllowNull(false);
+ fieldEngineerId.setIsPrimaryKey(true);
+ fieldEngineerId.setUnique(false);
+ fieldEngineerId.setIsIdentity(false);
+ fieldEngineerId.setForeignKeyFieldName("CMP3_ENGINEER.ID");
+ table.addField(fieldEngineerId);
+
+ FieldDefinition fieldDesktopMFR = new FieldDefinition();
+ fieldDesktopMFR.setName("DESKTOP_MFR");
+ fieldDesktopMFR.setTypeName("VARCHAR");
+ fieldDesktopMFR.setSize(30);
+ fieldDesktopMFR.setIsPrimaryKey(true);
+ fieldDesktopMFR.setIsIdentity(false);
+ fieldDesktopMFR.setUnique(false);
+ fieldDesktopMFR.setShouldAllowNull(false);
+ table.addField(fieldDesktopMFR);
+
+ FieldDefinition fieldDesktopSNO = new FieldDefinition();
+ fieldDesktopSNO.setName("DESKTOP_SNO");
+ fieldDesktopSNO.setTypeName("NUMBER");
+ fieldDesktopSNO.setSize(10);
+ fieldDesktopSNO.setSubSize(0);
+ fieldDesktopSNO.setIsPrimaryKey(true);
+ fieldDesktopSNO.setIsIdentity(false);
+ fieldDesktopSNO.setUnique(false);
+ fieldDesktopSNO.setShouldAllowNull(false);
+ table.addField(fieldDesktopSNO);
+
+ return table;
+ }
+
+ public TableDefinition buildLAPTOPTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_LAPTOP");
+
+ FieldDefinition fieldMFR = new FieldDefinition();
+ fieldMFR.setName("MFR");
+ fieldMFR.setTypeName("VARCHAR");
+ fieldMFR.setSize(30);
+ fieldMFR.setIsPrimaryKey(true);
+ fieldMFR.setIsIdentity(false);
+ fieldMFR.setUnique(false);
+ fieldMFR.setShouldAllowNull(false);
+ table.addField(fieldMFR);
+
+ FieldDefinition fieldSNO = new FieldDefinition();
+ fieldSNO.setName("SNO");
+ fieldSNO.setTypeName("NUMBER");
+ fieldSNO.setSize(10);
+ fieldSNO.setSubSize(0);
+ fieldSNO.setIsPrimaryKey(true);
+ fieldSNO.setIsIdentity(false);
+ fieldSNO.setUnique(false);
+ fieldSNO.setShouldAllowNull(false);
+ table.addField(fieldSNO);
+
+ // FOREIGN KEY (MFR, SNO) REFERENCES CMP3_COMPUTER (MFR, SNO)
+ ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
+ fkConstraint.setName("CMP3_LAPTOP_FK1");
+ fkConstraint.addSourceField("MFR");
+ fkConstraint.addSourceField("SNO");
+ fkConstraint.setTargetTable("CMP3_COMPUTER");
+ fkConstraint.addTargetField("MFR");
+ fkConstraint.addTargetField("SNO");
+
+ table.addForeignKeyConstraint(fkConstraint);
+ return table;
+ }
+
+ // Engineer-Laptop many-to-many relationship table
+ public TableDefinition buildENGINEER_LAPTOPTable() {
+ TableDefinition table = new TableDefinition();
+
+ table.setName("CMP3_ENGINEER_LAPTOP");
+
+ FieldDefinition fieldEngineerId = new FieldDefinition();
+ fieldEngineerId.setName("ENGINEER_ID");
+ fieldEngineerId.setTypeName("NUMBER");
+ fieldEngineerId.setSize(15);
+ fieldEngineerId.setSubSize(0);
+ fieldEngineerId.setShouldAllowNull(false);
+ fieldEngineerId.setIsPrimaryKey(true);
+ fieldEngineerId.setUnique(false);
+ fieldEngineerId.setIsIdentity(false);
+ fieldEngineerId.setForeignKeyFieldName("CMP3_ENGINEER.ID");
+ table.addField(fieldEngineerId);
+
+ FieldDefinition fieldLaptopMFR = new FieldDefinition();
+ fieldLaptopMFR.setName("LAPTOP_MFR");
+ fieldLaptopMFR.setTypeName("VARCHAR");
+ fieldLaptopMFR.setSize(30);
+ fieldLaptopMFR.setIsPrimaryKey(true);
+ fieldLaptopMFR.setIsIdentity(false);
+ fieldLaptopMFR.setUnique(false);
+ fieldLaptopMFR.setShouldAllowNull(false);
+ table.addField(fieldLaptopMFR);
+
+ FieldDefinition fieldLaptopSNO = new FieldDefinition();
+ fieldLaptopSNO.setName("LAPTOP_SNO");
+ fieldLaptopSNO.setTypeName("NUMBER");
+ fieldLaptopSNO.setSize(10);
+ fieldLaptopSNO.setSubSize(0);
+ fieldLaptopSNO.setIsPrimaryKey(true);
+ fieldLaptopSNO.setIsIdentity(false);
+ fieldLaptopSNO.setUnique(false);
+ fieldLaptopSNO.setShouldAllowNull(false);
+ table.addField(fieldLaptopSNO);
+
+ // FOREIGN KEY (LAPTOP_MFR, LAPTOP_SNO) REFERENCES CMP3_LAPTOP (MFR, SNO)
+ ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
+ fkConstraint.setName("CMP3_ENG_LAP_FK1");
+ fkConstraint.addSourceField("LAPTOP_MFR");
+ fkConstraint.addSourceField("LAPTOP_SNO");
+ fkConstraint.setTargetTable("CMP3_LAPTOP");
+ fkConstraint.addTargetField("MFR");
+ fkConstraint.addTargetField("SNO");
+
+ table.addForeignKeyConstraint(fkConstraint);
+ return table;
+ }
+
+ public TableDefinition buildWEAPONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_WEAPON");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ return table;
+ }
+
+ public TableDefinition buildDIRECTWEAPONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_DIR_WEAPON");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ return table;
+ }
+
+ public TableDefinition buildINDIRECTWEAPONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_IND_WEAPON");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ return table;
+ }
+
+ public TableDefinition buildGUNTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_GUN");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldCALIBER = new FieldDefinition();
+ fieldCALIBER.setName("CALIBER");
+ fieldCALIBER.setTypeName("NUMBER");
+ fieldCALIBER.setSize(10);
+ fieldCALIBER.setIsPrimaryKey(false);
+ fieldCALIBER.setIsIdentity(false);
+ fieldCALIBER.setUnique(false);
+ fieldCALIBER.setShouldAllowNull(false);
+ table.addField(fieldCALIBER);
+
+ FieldDefinition fieldMODEL = new FieldDefinition();
+ fieldMODEL.setName("MODEL");
+ fieldMODEL.setTypeName("VARCHAR");
+ fieldMODEL.setSize(50);
+ fieldMODEL.setIsPrimaryKey(false);
+ fieldMODEL.setIsIdentity(false);
+ fieldMODEL.setUnique(false);
+ fieldMODEL.setShouldAllowNull(true);
+ table.addField(fieldMODEL);
+
+ return table;
+ }
+
+ public TableDefinition buildKNIFETable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_KNIFE");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldBLADE = new FieldDefinition();
+ fieldBLADE.setName("BLADE");
+ fieldBLADE.setTypeName("NUMBER");
+ fieldBLADE.setSize(10);
+ fieldBLADE.setIsPrimaryKey(false);
+ fieldBLADE.setIsIdentity(false);
+ fieldBLADE.setUnique(false);
+ fieldBLADE.setShouldAllowNull(false);
+ table.addField(fieldBLADE);
+
+ FieldDefinition fieldKNIFE_TYPE = new FieldDefinition();
+ fieldKNIFE_TYPE.setName("KNIFE_TYPE");
+ fieldKNIFE_TYPE.setTypeName("VARCHAR");
+ fieldKNIFE_TYPE.setSize(50);
+ fieldKNIFE_TYPE.setIsPrimaryKey(false);
+ fieldKNIFE_TYPE.setIsIdentity(false);
+ fieldKNIFE_TYPE.setUnique(false);
+ fieldKNIFE_TYPE.setShouldAllowNull(true);
+ table.addField(fieldKNIFE_TYPE);
+
+ return table;
+ }
+
+ public TableDefinition buildPOISONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_POISON");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("E_TIME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public TableDefinition buildBOMBTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_BOMB");
+
+ FieldDefinition fieldSERIAL_NUMBER = new FieldDefinition();
+ fieldSERIAL_NUMBER.setName("SERIAL_NUMBER");
+ fieldSERIAL_NUMBER.setTypeName("NUMBER");
+ fieldSERIAL_NUMBER.setSize(10);
+ fieldSERIAL_NUMBER.setIsPrimaryKey(true);
+ fieldSERIAL_NUMBER.setIsIdentity(false);
+ fieldSERIAL_NUMBER.setUnique(false);
+ fieldSERIAL_NUMBER.setShouldAllowNull(false);
+ table.addField(fieldSERIAL_NUMBER);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldBOMB_TYPE = new FieldDefinition();
+ fieldBOMB_TYPE.setName("B_TYPE");
+ fieldBOMB_TYPE.setTypeName("NUMBER");
+ fieldBOMB_TYPE.setSize(10);
+ fieldBOMB_TYPE.setIsPrimaryKey(false);
+ fieldBOMB_TYPE.setIsIdentity(false);
+ fieldBOMB_TYPE.setUnique(false);
+ fieldBOMB_TYPE.setShouldAllowNull(true);
+ table.addField(fieldBOMB_TYPE);
+
+ return table;
+ }
+
+ public TableDefinition buildELIMINATIONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_ELIMINATION");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(false);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldASSASSIN = new FieldDefinition();
+ fieldASSASSIN.setName("ASSASSIN_ID");
+ fieldASSASSIN.setTypeName("NUMBER");
+ fieldASSASSIN.setSize(10);
+ fieldASSASSIN.setIsPrimaryKey(false);
+ fieldASSASSIN.setIsIdentity(false);
+ fieldASSASSIN.setUnique(false);
+ fieldASSASSIN.setShouldAllowNull(false);
+ table.addField(fieldASSASSIN);
+
+ return table;
+ }
+
+ public TableDefinition buildDIRECTELIMINATIONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_DIR_ELIMINATION");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(false);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldASSASSIN = new FieldDefinition();
+ fieldASSASSIN.setName("ASSASSIN_ID");
+ fieldASSASSIN.setTypeName("NUMBER");
+ fieldASSASSIN.setSize(10);
+ fieldASSASSIN.setIsPrimaryKey(false);
+ fieldASSASSIN.setIsIdentity(false);
+ fieldASSASSIN.setUnique(false);
+ fieldASSASSIN.setShouldAllowNull(false);
+ table.addField(fieldASSASSIN);
+
+ FieldDefinition fieldWEAPON = new FieldDefinition();
+ fieldWEAPON.setName("WEAPON_ID");
+ fieldWEAPON.setTypeName("NUMBER");
+ fieldWEAPON.setSize(10);
+ fieldWEAPON.setIsPrimaryKey(false);
+ fieldWEAPON.setIsIdentity(false);
+ fieldWEAPON.setUnique(false);
+ fieldWEAPON.setShouldAllowNull(false);
+ table.addField(fieldWEAPON);
+
+ return table;
+ }
+
+ public TableDefinition buildINDIRECTELIMINATIONTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_IND_ELIMINATION");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(false);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(false);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldDESCRIP = new FieldDefinition();
+ fieldDESCRIP.setName("DESCRIP");
+ fieldDESCRIP.setTypeName("VARCHAR");
+ fieldDESCRIP.setSize(50);
+ fieldDESCRIP.setIsPrimaryKey(false);
+ fieldDESCRIP.setIsIdentity(false);
+ fieldDESCRIP.setUnique(false);
+ fieldDESCRIP.setShouldAllowNull(true);
+ table.addField(fieldDESCRIP);
+
+ FieldDefinition fieldASSASSIN = new FieldDefinition();
+ fieldASSASSIN.setName("ASSASSIN_ID");
+ fieldASSASSIN.setTypeName("NUMBER");
+ fieldASSASSIN.setSize(10);
+ fieldASSASSIN.setIsPrimaryKey(false);
+ fieldASSASSIN.setIsIdentity(false);
+ fieldASSASSIN.setUnique(false);
+ fieldASSASSIN.setShouldAllowNull(false);
+ table.addField(fieldASSASSIN);
+
+ FieldDefinition fieldWEAPON = new FieldDefinition();
+ fieldWEAPON.setName("WEAPON_ID");
+ fieldWEAPON.setTypeName("NUMBER");
+ fieldWEAPON.setSize(10);
+ fieldWEAPON.setIsPrimaryKey(false);
+ fieldWEAPON.setIsIdentity(false);
+ fieldWEAPON.setUnique(false);
+ fieldWEAPON.setShouldAllowNull(false);
+ table.addField(fieldWEAPON);
+
+ return table;
+ }
+
+ public TableDefinition buildCONTRACTEDPERSONELTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_PERSONEL");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldVERSION = new FieldDefinition();
+ fieldVERSION.setName("VERSION");
+ fieldVERSION.setTypeName("NUMERIC");
+ fieldVERSION.setSize(15);
+ fieldVERSION.setShouldAllowNull(true);
+ fieldVERSION.setIsPrimaryKey(false);
+ fieldVERSION.setUnique(false);
+ fieldVERSION.setIsIdentity(false);
+ table.addField(fieldVERSION);
+
+ return table;
+ }
+
+ public TableDefinition buildASSASSINTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_ASSASSIN");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldWEAPON = new FieldDefinition();
+ fieldWEAPON.setName("WEAPON_ID");
+ fieldWEAPON.setTypeName("NUMBER");
+ fieldWEAPON.setSize(10);
+ fieldWEAPON.setIsPrimaryKey(false);
+ fieldWEAPON.setIsIdentity(false);
+ fieldWEAPON.setUnique(false);
+ fieldWEAPON.setShouldAllowNull(true);
+ table.addField(fieldWEAPON);
+
+ FieldDefinition fieldVERSION = new FieldDefinition();
+ fieldVERSION.setName("VERSION");
+ fieldVERSION.setTypeName("NUMERIC");
+ fieldVERSION.setSize(15);
+ fieldVERSION.setShouldAllowNull(true);
+ fieldVERSION.setIsPrimaryKey(false);
+ fieldVERSION.setUnique(false);
+ fieldVERSION.setIsIdentity(false);
+ table.addField(fieldVERSION);
+
+ return table;
+ }
+
+ public TableDefinition buildSPECIALASSASSINTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_SPECIAL_ASSASSIN");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldWEAPON = new FieldDefinition();
+ fieldWEAPON.setName("WEAPON_ID");
+ fieldWEAPON.setTypeName("NUMBER");
+ fieldWEAPON.setSize(10);
+ fieldWEAPON.setIsPrimaryKey(false);
+ fieldWEAPON.setIsIdentity(false);
+ fieldWEAPON.setUnique(false);
+ fieldWEAPON.setShouldAllowNull(true);
+ table.addField(fieldWEAPON);
+
+ FieldDefinition fieldVERSION = new FieldDefinition();
+ fieldVERSION.setName("SP_VERSION");
+ fieldVERSION.setTypeName("NUMERIC");
+ fieldVERSION.setSize(15);
+ fieldVERSION.setShouldAllowNull(true);
+ fieldVERSION.setIsPrimaryKey(false);
+ fieldVERSION.setUnique(false);
+ fieldVERSION.setIsIdentity(false);
+ table.addField(fieldVERSION);
+
+ return table;
+ }
+
+ public TableDefinition buildSOCIALCLUBTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_SOCIAL_CLUB");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public TableDefinition buildPERSONELCLUBTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_PERSONEL_CLUB");
+
+ FieldDefinition fieldPERSONELID = new FieldDefinition();
+ fieldPERSONELID.setName("PERSONEL_ID");
+ fieldPERSONELID.setTypeName("NUMERIC");
+ fieldPERSONELID.setSize(10);
+ fieldPERSONELID.setShouldAllowNull(false);
+ fieldPERSONELID.setIsPrimaryKey(true);
+ fieldPERSONELID.setUnique(false);
+ fieldPERSONELID.setIsIdentity(false);
+ // Can't set foreign key field constraints.
+ //fieldPERSONELID.setForeignKeyFieldName("CMP3_PERSONEL.ID");
+ table.addField(fieldPERSONELID);
+
+ FieldDefinition fieldCLUBID = new FieldDefinition();
+ fieldCLUBID.setName("CLUB_ID");
+ fieldCLUBID.setTypeName("NUMERIC");
+ fieldCLUBID.setSize(10);
+ fieldCLUBID.setShouldAllowNull(false);
+ fieldCLUBID.setIsPrimaryKey(true);
+ fieldCLUBID.setUnique(false);
+ fieldCLUBID.setIsIdentity(false);
+ // Can't set foreign key field constraints.
+ //fieldCLUBID.setForeignKeyFieldName("CMP3_SOCIAL_CLUB.ID");
+ table.addField(fieldCLUBID);
+
+ return table;
+ }
+
+ public TableDefinition buildNICKNAMESTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_NICKNAMES");
+
+ FieldDefinition fieldPERSONELID = new FieldDefinition();
+ fieldPERSONELID.setName("PERSONEL_ID");
+ fieldPERSONELID.setTypeName("NUMERIC");
+ fieldPERSONELID.setSize(10);
+ fieldPERSONELID.setShouldAllowNull(false);
+ fieldPERSONELID.setIsPrimaryKey(true);
+ fieldPERSONELID.setUnique(false);
+ fieldPERSONELID.setIsIdentity(false);
+ // Can't set foreign key field constraints.
+ //fieldPERSONELID.setForeignKeyFieldName("CMP3_PERSONEL.ID");
+ table.addField(fieldPERSONELID);
+
+ FieldDefinition fieldNICKNAME = new FieldDefinition();
+ fieldNICKNAME.setName("NICKNAME");
+ fieldNICKNAME.setTypeName("VARCHAR");
+ fieldNICKNAME.setSize(50);
+ fieldNICKNAME.setShouldAllowNull(false);
+ fieldNICKNAME.setIsPrimaryKey(true);
+ fieldNICKNAME.setUnique(false);
+ fieldNICKNAME.setIsIdentity(false);
+ table.addField(fieldNICKNAME);
+
+ return table;
+ }
+
+ public TableDefinition buildSMALLASSIGNMENTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("TPC_SMALL_ASSIGNMENT");
+
+ FieldDefinition fieldSMALLID = new FieldDefinition();
+ fieldSMALLID.setName("SMALL_ID");
+ fieldSMALLID.setTypeName("NUMERIC");
+ fieldSMALLID.setSize(10);
+ fieldSMALLID.setShouldAllowNull(false);
+ fieldSMALLID.setIsPrimaryKey(true);
+ fieldSMALLID.setUnique(false);
+ fieldSMALLID.setIsIdentity(false);
+ table.addField(fieldSMALLID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(50);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ return table;
+ }
+
+ public TableDefinition buildCMP3_SEEDED_FRUITTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_SEEDED_FRUIT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(255);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldCLASS_TYPE = new FieldDefinition();
+ fieldCLASS_TYPE.setName("CLASS_TYPE");
+ fieldCLASS_TYPE.setTypeName("VARCHAR");
+ fieldCLASS_TYPE.setSize(1);
+ fieldCLASS_TYPE.setIsPrimaryKey(false);
+ fieldCLASS_TYPE.setIsIdentity(false);
+ fieldCLASS_TYPE.setUnique(false);
+ fieldCLASS_TYPE.setShouldAllowNull(true);
+ table.addField(fieldCLASS_TYPE);
+
+ return table;
+ }
+
+ public TableDefinition buildCMP3_CITRUS_FRUITTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_CITRUS_FRUIT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setForeignKeyFieldName("CMP3_SEEDED_FRUIT.ID");
+ table.addField(fieldID);
+
+ FieldDefinition fieldGRADE = new FieldDefinition();
+ fieldGRADE.setName("GRADE");
+ fieldGRADE.setTypeName("NUMBER");
+ fieldGRADE.setSize(10);
+ fieldGRADE.setIsPrimaryKey(false);
+ fieldGRADE.setIsIdentity(false);
+ fieldGRADE.setUnique(false);
+ fieldGRADE.setShouldAllowNull(true);
+ table.addField(fieldGRADE);
+
+ return table;
+ }
+
+ public TableDefinition buildCMP3_SEEDTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_SEED");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMBER");
+ fieldID.setSize(10);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(false);
+ fieldID.setUnique(false);
+ fieldID.setShouldAllowNull(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldNAME = new FieldDefinition();
+ fieldNAME.setName("NAME");
+ fieldNAME.setTypeName("VARCHAR");
+ fieldNAME.setSize(64);
+ fieldNAME.setIsPrimaryKey(false);
+ fieldNAME.setIsIdentity(false);
+ fieldNAME.setUnique(false);
+ fieldNAME.setShouldAllowNull(true);
+ table.addField(fieldNAME);
+
+ FieldDefinition fieldSEEDEDFRUIT_ID = new FieldDefinition();
+ fieldSEEDEDFRUIT_ID.setName("SEEDEDFRUIT_ID");
+ fieldSEEDEDFRUIT_ID.setTypeName("NUMBER");
+ fieldSEEDEDFRUIT_ID.setSize(10);
+ fieldSEEDEDFRUIT_ID.setIsPrimaryKey(false);
+ fieldSEEDEDFRUIT_ID.setIsIdentity(false);
+ fieldSEEDEDFRUIT_ID.setUnique(false);
+ fieldSEEDEDFRUIT_ID.setShouldAllowNull(true);
+ fieldSEEDEDFRUIT_ID.setForeignKeyFieldName("CMP3_SEEDED_FRUIT.ID");
+ table.addField(fieldSEEDEDFRUIT_ID);
+
+ return table;
+ }
+
+ /**
+ * Dropping old foreign keys from schema change.
+ */
+ public void replaceTables(DatabaseSession session) {
+ try {
+ if (session.getPlatform().supportsUniqueKeyConstraints()
+ && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
+ if (session.getPlatform().isMySQL()) {
+ session.executeNonSelectingSQL("Alter table CMP3_ENGINEER_LAPTOP drop foreign key CMP3_ENGINEER_LAPTOP_FK1");
+ } else {
+ session.executeNonSelectingSQL("Alter table CMP3_ENGINEER_LAPTOP drop constraint CMP3_ENGINEER_LAPTOP_FK1");
+ }
+ }
+ } catch (Exception ignore) {}
+ super.replaceTables(session);
+ }
+}
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/orphanremoval/OrphanRemovalModelTableCreator.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/orphanremoval/OrphanRemovalModelTableCreator.java
index 9dba7ad..6f61414 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/orphanremoval/OrphanRemovalModelTableCreator.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/orphanremoval/OrphanRemovalModelTableCreator.java
@@ -1,376 +1,385 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * 05/1/2009-2.0 Guy Pelletier/David Minsky
- * - 249033: JPA 2.0 Orphan removal
- ******************************************************************************/
-package org.eclipse.persistence.testing.models.jpa.orphanremoval;
-
-import org.eclipse.persistence.sessions.DatabaseSession;
-import org.eclipse.persistence.tools.schemaframework.*;
-
-public class OrphanRemovalModelTableCreator extends TableCreator {
-
- public OrphanRemovalModelTableCreator() {
- setName("JPAOrphanRemovalModelTableCreator");
- addTableDefinition(buildVEHICLETable());
- addTableDefinition(buildCHASSISTable());
- addTableDefinition(buildENGINETable());
- addTableDefinition(buildSPARKPLUGTable());
- addTableDefinition(buildWHEELTable());
- addTableDefinition(buildWHEELRIMTable());
- addTableDefinition(buildWHEELNUTTable());
- }
-
- public static TableDefinition buildCHASSISTable() {
- // CREATE TABLE JPA_OR_CHASSIS (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_CHASSIS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition serialNumber = new FieldDefinition();
- serialNumber.setName("SERIALNUMBER");
- serialNumber.setTypeName("NUMERIC");
- serialNumber.setSize(18);
- serialNumber.setSubSize(0);
- serialNumber.setIsPrimaryKey(false);
- serialNumber.setIsIdentity(false);
- serialNumber.setShouldAllowNull(true);
- serialNumber.setUnique(false);
- table.addField(serialNumber);
-
- return table;
- }
-
- public static TableDefinition buildVEHICLETable() {
- // CREATE TABLE JPA_OR_VEHICLE (ID NUMBER(10) NOT NULL, MODEL VARCHAR2(255) NULL, CHASSIS_ID NUMBER(10) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_VEHICLE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldMODEL = new FieldDefinition();
- fieldMODEL.setName("MODEL");
- fieldMODEL.setTypeName("VARCHAR");
- fieldMODEL.setSize(60);
- fieldMODEL.setSubSize(0);
- fieldMODEL.setIsPrimaryKey(false);
- fieldMODEL.setIsIdentity(false);
- fieldMODEL.setShouldAllowNull(true);
- fieldMODEL.setUnique(false);
- table.addField(fieldMODEL);
-
- FieldDefinition fieldCHASSIS = new FieldDefinition();
- fieldCHASSIS.setName("CHASSIS_ID");
- fieldCHASSIS.setTypeName("NUMERIC");
- fieldCHASSIS.setSize(10);
- fieldCHASSIS.setSubSize(0);
- fieldCHASSIS.setIsPrimaryKey(false);
- fieldCHASSIS.setIsIdentity(false);
- fieldCHASSIS.setShouldAllowNull(true);
- fieldCHASSIS.setUnique(false);
- table.addField(fieldCHASSIS);
-
- FieldDefinition fieldENGINE = new FieldDefinition();
- fieldENGINE.setName("ENGINE_ID");
- fieldENGINE.setTypeName("NUMERIC");
- fieldENGINE.setSize(10);
- fieldENGINE.setSubSize(0);
- fieldENGINE.setIsPrimaryKey(false);
- fieldENGINE.setIsIdentity(false);
- fieldENGINE.setShouldAllowNull(true);
- fieldENGINE.setUnique(false);
- table.addField(fieldENGINE);
-
- // ALTER TABLE JPA_OR_VEHICLE ADD CONSTRAINT FK_JPA_OR_VEHICLE_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES JPA_OR_ENGINE (ID)
- ForeignKeyConstraint foreignKeyVEHICLE_ENGINE = new ForeignKeyConstraint();
- foreignKeyVEHICLE_ENGINE.setName("FK_OR_VEH_ENG_ID");
- foreignKeyVEHICLE_ENGINE.setTargetTable("JPA_OR_ENGINE");
- foreignKeyVEHICLE_ENGINE.addSourceField("ENGINE_ID");
- foreignKeyVEHICLE_ENGINE.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyVEHICLE_ENGINE);
-
- // ALTER TABLE JPA_OR_VEHICLE ADD CONSTRAINT FK_JPA_OR_VEHICLE_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES JPA_OR_CHASSIS (ID)
- ForeignKeyConstraint foreignKeyVEHICLE_CHASSIS = new ForeignKeyConstraint();
- foreignKeyVEHICLE_CHASSIS.setName("FK_OR_VEH_CHAS_ID");
- foreignKeyVEHICLE_CHASSIS.setTargetTable("JPA_OR_CHASSIS");
- foreignKeyVEHICLE_CHASSIS.addSourceField("CHASSIS_ID");
- foreignKeyVEHICLE_CHASSIS.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyVEHICLE_CHASSIS);
-
- return table;
- }
-
- public static TableDefinition buildENGINETable() {
- // CREATE TABLE JPA_OR_ENGINE (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_ENGINE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
- fieldSERIALNUMBER.setName("SERIALNUMBER");
- fieldSERIALNUMBER.setTypeName("NUMERIC");
- fieldSERIALNUMBER.setSize(18);
- fieldSERIALNUMBER.setSubSize(0);
- fieldSERIALNUMBER.setIsPrimaryKey(false);
- fieldSERIALNUMBER.setIsIdentity(false);
- fieldSERIALNUMBER.setShouldAllowNull(true);
- fieldSERIALNUMBER.setUnique(false);
- table.addField(fieldSERIALNUMBER);
-
- return table;
- }
-
- public static TableDefinition buildSPARKPLUGTable() {
- // CREATE TABLE JPA_OR_SPARK_PLUG (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_SPARK_PLUG");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
- fieldSERIALNUMBER.setName("SERIALNUMBER");
- fieldSERIALNUMBER.setTypeName("NUMERIC");
- fieldSERIALNUMBER.setSize(18);
- fieldSERIALNUMBER.setSubSize(0);
- fieldSERIALNUMBER.setIsPrimaryKey(false);
- fieldSERIALNUMBER.setIsIdentity(false);
- fieldSERIALNUMBER.setShouldAllowNull(true);
- fieldSERIALNUMBER.setUnique(false);
- table.addField(fieldSERIALNUMBER);
-
- FieldDefinition fieldENGINE = new FieldDefinition();
- fieldENGINE.setName("ENGINE_ID");
- fieldENGINE.setTypeName("NUMERIC");
- fieldENGINE.setSize(10);
- fieldENGINE.setSubSize(0);
- fieldENGINE.setIsPrimaryKey(false);
- fieldENGINE.setIsIdentity(false);
- fieldENGINE.setShouldAllowNull(true);
- fieldENGINE.setUnique(false);
- table.addField(fieldENGINE);
-
- // ALTER TABLE JPA_OR_SPARK_PLUG ADD CONSTRAINT JPA_OR_SPARK_PLUG_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES JPA_OR_ENGINE (ID)
- ForeignKeyConstraint foreignKeySPARKPLUG_ENGINE = new ForeignKeyConstraint();
- foreignKeySPARKPLUG_ENGINE.setName("FK_SPK_PG_ENG_ID");
- foreignKeySPARKPLUG_ENGINE.setTargetTable("JPA_OR_ENGINE");
- foreignKeySPARKPLUG_ENGINE.addSourceField("ENGINE_ID");
- foreignKeySPARKPLUG_ENGINE.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeySPARKPLUG_ENGINE);
-
- return table;
- }
-
- public static TableDefinition buildWHEELTable() {
- // CREATE TABLE JPA_OR_WHEEL (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, WHEELRIM_ID NUMBER(10) NULL,
- // CHASSIS_ID NUMBER(10) NULL, MANUFACTURER VARCHAR2(255) NULL, TYPE VARCHAR2(255) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_WHEEL");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
- fieldSERIALNUMBER.setName("SERIALNUMBER");
- fieldSERIALNUMBER.setTypeName("NUMERIC");
- fieldSERIALNUMBER.setSize(18);
- fieldSERIALNUMBER.setSubSize(0);
- fieldSERIALNUMBER.setIsPrimaryKey(false);
- fieldSERIALNUMBER.setIsIdentity(false);
- fieldSERIALNUMBER.setShouldAllowNull(true);
- fieldSERIALNUMBER.setUnique(false);
- table.addField(fieldSERIALNUMBER);
-
- FieldDefinition fieldWHEELRIM = new FieldDefinition();
- fieldWHEELRIM.setName("WHEELRIM_ID");
- fieldWHEELRIM.setTypeName("NUMERIC");
- fieldWHEELRIM.setSize(10);
- fieldWHEELRIM.setSubSize(0);
- fieldWHEELRIM.setIsPrimaryKey(false);
- fieldWHEELRIM.setIsIdentity(false);
- fieldWHEELRIM.setShouldAllowNull(true);
- fieldWHEELRIM.setUnique(false);
- table.addField(fieldWHEELRIM);
-
- FieldDefinition fieldCHASSIS = new FieldDefinition();
- fieldCHASSIS.setName("CHASSIS_ID");
- fieldCHASSIS.setTypeName("NUMERIC");
- fieldCHASSIS.setSize(10);
- fieldCHASSIS.setSubSize(0);
- fieldCHASSIS.setIsPrimaryKey(false);
- fieldCHASSIS.setIsIdentity(false);
- fieldCHASSIS.setShouldAllowNull(true);
- fieldCHASSIS.setUnique(false);
- table.addField(fieldCHASSIS);
-
- FieldDefinition fieldMANUFACTURER = new FieldDefinition();
- fieldMANUFACTURER.setName("MANUFACTURER");
- fieldMANUFACTURER.setTypeName("VARCHAR");
- fieldMANUFACTURER.setSize(60);
- fieldMANUFACTURER.setSubSize(0);
- fieldMANUFACTURER.setIsPrimaryKey(false);
- fieldMANUFACTURER.setIsIdentity(false);
- fieldMANUFACTURER.setShouldAllowNull(true);
- fieldMANUFACTURER.setUnique(false);
- table.addField(fieldMANUFACTURER);
-
- FieldDefinition fieldTYPE = new FieldDefinition();
- fieldTYPE.setName("TYPE");
- fieldTYPE.setTypeName("VARCHAR");
- fieldTYPE.setSize(60);
- fieldTYPE.setSubSize(0);
- fieldTYPE.setIsPrimaryKey(false);
- fieldTYPE.setIsIdentity(false);
- fieldTYPE.setShouldAllowNull(true);
- fieldTYPE.setUnique(false);
- table.addField(fieldTYPE);
-
- // ALTER TABLE JPA_OR_WHEEL ADD CONSTRAINT FK_JPA_OR_WHEEL_WHEELRIM_ID FOREIGN KEY (WHEELRIM_ID) REFERENCES JPA_OR_WHEEL_RIM (ID)
- ForeignKeyConstraint foreignKeyWHEEL_WHEELRIM = new ForeignKeyConstraint();
- foreignKeyWHEEL_WHEELRIM.setName("FK_WHL_WHLRM_ID");
- foreignKeyWHEEL_WHEELRIM.setTargetTable("JPA_OR_WHEEL_RIM");
- foreignKeyWHEEL_WHEELRIM.addSourceField("WHEELRIM_ID");
- foreignKeyWHEEL_WHEELRIM.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyWHEEL_WHEELRIM);
-
- // ALTER TABLE JPA_OR_WHEEL ADD CONSTRAINT FK_JPA_OR_WHEEL_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES JPA_OR_CHASSIS (ID)
- ForeignKeyConstraint foreignKeyWHEEL_CHASSIS = new ForeignKeyConstraint();
- foreignKeyWHEEL_CHASSIS.setName("FK_WHL_CHAS_ID");
- foreignKeyWHEEL_CHASSIS.setTargetTable("JPA_OR_CHASSIS");
- foreignKeyWHEEL_CHASSIS.addSourceField("CHASSIS_ID");
- foreignKeyWHEEL_CHASSIS.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyWHEEL_CHASSIS);
-
- return table;
- }
-
- public static TableDefinition buildWHEELRIMTable() {
- // CREATE TABLE JPA_OR_WHEEL_RIM (ID NUMBER(10) NOT NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_WHEEL_RIM");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- return table;
- }
-
- public static TableDefinition buildWHEELNUTTable() {
- // CREATE TABLE JPA_OR_WHEEL_NUT (ID NUMBER(10) NOT NULL, WHEEL_ID NUMBER(10) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("JPA_OR_WHEEL_NUT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldWHEEL = new FieldDefinition();
- fieldWHEEL.setName("WHEEL_ID");
- fieldWHEEL.setTypeName("NUMERIC");
- fieldWHEEL.setSize(10);
- fieldWHEEL.setSubSize(0);
- fieldWHEEL.setIsPrimaryKey(false);
- fieldWHEEL.setIsIdentity(false);
- fieldWHEEL.setShouldAllowNull(true);
- fieldWHEEL.setUnique(false);
- table.addField(fieldWHEEL);
-
- // ALTER TABLE JPA_OR_WHEEL_NUT ADD CONSTRAINT FK_JPA_OR_WHEEL_NUT_WHEEL_ID FOREIGN KEY (WHEEL_ID) REFERENCES JPA_OR_WHEEL (ID)
- ForeignKeyConstraint foreignKeyWHEELNUT_WHEEL = new ForeignKeyConstraint();
- foreignKeyWHEELNUT_WHEEL.setName("FK_WH_NUT_WL_ID");
- foreignKeyWHEELNUT_WHEEL.setTargetTable("JPA_OR_WHEEL");
- foreignKeyWHEELNUT_WHEEL.addSourceField("WHEEL_ID");
- foreignKeyWHEELNUT_WHEEL.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyWHEELNUT_WHEEL);
-
- return table;
- }
-
- /**
- * Dropping old foreign keys from schema change.
- */
- @Override
- public void replaceTables(DatabaseSession session) {
- if (session.getPlatform().supportsUniqueKeyConstraints()
- && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
- try {
- session.executeNonSelectingSQL("Alter table JPA_OR_SPARK_PLUG drop constraint JPA_OR_SPARK_PLUG_ENGINE_ID");
- session.executeNonSelectingSQL("Alter table JPA_OR_VEHICLE drop constraint FK_JPA_OR_VEHICLE_ENGINE_ID");
- session.executeNonSelectingSQL("Alter table JPA_OR_VEHICLE drop constraint FK_JPA_OR_VEHICLE_CHASSIS_ID");
- session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL drop constraint FK_JPA_OR_WHEEL_WHEELRIM_ID");
- session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL drop constraint FK_JPA_OR_WHEEL_CHASSIS_ID");
- session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL_NUT drop constraint FK_JPA_OR_WHEEL_NUT_WHEEL_ID");
- } catch (Exception ignore) {}
- }
- super.replaceTables(session);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * 05/1/2009-2.0 Guy Pelletier/David Minsky
+ * - 249033: JPA 2.0 Orphan removal
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.jpa.orphanremoval;
+
+import org.eclipse.persistence.sessions.DatabaseSession;
+import org.eclipse.persistence.tools.schemaframework.*;
+
+public class OrphanRemovalModelTableCreator extends TableCreator {
+
+ public OrphanRemovalModelTableCreator() {
+ setName("JPAOrphanRemovalModelTableCreator");
+ addTableDefinition(buildVEHICLETable());
+ addTableDefinition(buildCHASSISTable());
+ addTableDefinition(buildENGINETable());
+ addTableDefinition(buildSPARKPLUGTable());
+ addTableDefinition(buildWHEELTable());
+ addTableDefinition(buildWHEELRIMTable());
+ addTableDefinition(buildWHEELNUTTable());
+ }
+
+ public static TableDefinition buildCHASSISTable() {
+ // CREATE TABLE JPA_OR_CHASSIS (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_CHASSIS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition serialNumber = new FieldDefinition();
+ serialNumber.setName("SERIALNUMBER");
+ serialNumber.setTypeName("NUMERIC");
+ serialNumber.setSize(18);
+ serialNumber.setSubSize(0);
+ serialNumber.setIsPrimaryKey(false);
+ serialNumber.setIsIdentity(false);
+ serialNumber.setShouldAllowNull(true);
+ serialNumber.setUnique(false);
+ table.addField(serialNumber);
+
+ return table;
+ }
+
+ public static TableDefinition buildVEHICLETable() {
+ // CREATE TABLE JPA_OR_VEHICLE (ID NUMBER(10) NOT NULL, MODEL VARCHAR2(255) NULL, CHASSIS_ID NUMBER(10) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_VEHICLE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldMODEL = new FieldDefinition();
+ fieldMODEL.setName("MODEL");
+ fieldMODEL.setTypeName("VARCHAR");
+ fieldMODEL.setSize(60);
+ fieldMODEL.setSubSize(0);
+ fieldMODEL.setIsPrimaryKey(false);
+ fieldMODEL.setIsIdentity(false);
+ fieldMODEL.setShouldAllowNull(true);
+ fieldMODEL.setUnique(false);
+ table.addField(fieldMODEL);
+
+ FieldDefinition fieldCHASSIS = new FieldDefinition();
+ fieldCHASSIS.setName("CHASSIS_ID");
+ fieldCHASSIS.setTypeName("NUMERIC");
+ fieldCHASSIS.setSize(10);
+ fieldCHASSIS.setSubSize(0);
+ fieldCHASSIS.setIsPrimaryKey(false);
+ fieldCHASSIS.setIsIdentity(false);
+ fieldCHASSIS.setShouldAllowNull(true);
+ fieldCHASSIS.setUnique(false);
+ table.addField(fieldCHASSIS);
+
+ FieldDefinition fieldENGINE = new FieldDefinition();
+ fieldENGINE.setName("ENGINE_ID");
+ fieldENGINE.setTypeName("NUMERIC");
+ fieldENGINE.setSize(10);
+ fieldENGINE.setSubSize(0);
+ fieldENGINE.setIsPrimaryKey(false);
+ fieldENGINE.setIsIdentity(false);
+ fieldENGINE.setShouldAllowNull(true);
+ fieldENGINE.setUnique(false);
+ table.addField(fieldENGINE);
+
+ // ALTER TABLE JPA_OR_VEHICLE ADD CONSTRAINT FK_JPA_OR_VEHICLE_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES JPA_OR_ENGINE (ID)
+ ForeignKeyConstraint foreignKeyVEHICLE_ENGINE = new ForeignKeyConstraint();
+ foreignKeyVEHICLE_ENGINE.setName("FK_OR_VEH_ENG_ID");
+ foreignKeyVEHICLE_ENGINE.setTargetTable("JPA_OR_ENGINE");
+ foreignKeyVEHICLE_ENGINE.addSourceField("ENGINE_ID");
+ foreignKeyVEHICLE_ENGINE.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyVEHICLE_ENGINE);
+
+ // ALTER TABLE JPA_OR_VEHICLE ADD CONSTRAINT FK_JPA_OR_VEHICLE_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES JPA_OR_CHASSIS (ID)
+ ForeignKeyConstraint foreignKeyVEHICLE_CHASSIS = new ForeignKeyConstraint();
+ foreignKeyVEHICLE_CHASSIS.setName("FK_OR_VEH_CHAS_ID");
+ foreignKeyVEHICLE_CHASSIS.setTargetTable("JPA_OR_CHASSIS");
+ foreignKeyVEHICLE_CHASSIS.addSourceField("CHASSIS_ID");
+ foreignKeyVEHICLE_CHASSIS.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyVEHICLE_CHASSIS);
+
+ return table;
+ }
+
+ public static TableDefinition buildENGINETable() {
+ // CREATE TABLE JPA_OR_ENGINE (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_ENGINE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
+ fieldSERIALNUMBER.setName("SERIALNUMBER");
+ fieldSERIALNUMBER.setTypeName("NUMERIC");
+ fieldSERIALNUMBER.setSize(18);
+ fieldSERIALNUMBER.setSubSize(0);
+ fieldSERIALNUMBER.setIsPrimaryKey(false);
+ fieldSERIALNUMBER.setIsIdentity(false);
+ fieldSERIALNUMBER.setShouldAllowNull(true);
+ fieldSERIALNUMBER.setUnique(false);
+ table.addField(fieldSERIALNUMBER);
+
+ return table;
+ }
+
+ public static TableDefinition buildSPARKPLUGTable() {
+ // CREATE TABLE JPA_OR_SPARK_PLUG (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_SPARK_PLUG");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
+ fieldSERIALNUMBER.setName("SERIALNUMBER");
+ fieldSERIALNUMBER.setTypeName("NUMERIC");
+ fieldSERIALNUMBER.setSize(18);
+ fieldSERIALNUMBER.setSubSize(0);
+ fieldSERIALNUMBER.setIsPrimaryKey(false);
+ fieldSERIALNUMBER.setIsIdentity(false);
+ fieldSERIALNUMBER.setShouldAllowNull(true);
+ fieldSERIALNUMBER.setUnique(false);
+ table.addField(fieldSERIALNUMBER);
+
+ FieldDefinition fieldENGINE = new FieldDefinition();
+ fieldENGINE.setName("ENGINE_ID");
+ fieldENGINE.setTypeName("NUMERIC");
+ fieldENGINE.setSize(10);
+ fieldENGINE.setSubSize(0);
+ fieldENGINE.setIsPrimaryKey(false);
+ fieldENGINE.setIsIdentity(false);
+ fieldENGINE.setShouldAllowNull(true);
+ fieldENGINE.setUnique(false);
+ table.addField(fieldENGINE);
+
+ // ALTER TABLE JPA_OR_SPARK_PLUG ADD CONSTRAINT JPA_OR_SPARK_PLUG_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES JPA_OR_ENGINE (ID)
+ ForeignKeyConstraint foreignKeySPARKPLUG_ENGINE = new ForeignKeyConstraint();
+ foreignKeySPARKPLUG_ENGINE.setName("FK_SPK_PG_ENG_ID");
+ foreignKeySPARKPLUG_ENGINE.setTargetTable("JPA_OR_ENGINE");
+ foreignKeySPARKPLUG_ENGINE.addSourceField("ENGINE_ID");
+ foreignKeySPARKPLUG_ENGINE.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeySPARKPLUG_ENGINE);
+
+ return table;
+ }
+
+ public static TableDefinition buildWHEELTable() {
+ // CREATE TABLE JPA_OR_WHEEL (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, WHEELRIM_ID NUMBER(10) NULL,
+ // CHASSIS_ID NUMBER(10) NULL, MANUFACTURER VARCHAR2(255) NULL, TYPE VARCHAR2(255) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_WHEEL");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
+ fieldSERIALNUMBER.setName("SERIALNUMBER");
+ fieldSERIALNUMBER.setTypeName("NUMERIC");
+ fieldSERIALNUMBER.setSize(18);
+ fieldSERIALNUMBER.setSubSize(0);
+ fieldSERIALNUMBER.setIsPrimaryKey(false);
+ fieldSERIALNUMBER.setIsIdentity(false);
+ fieldSERIALNUMBER.setShouldAllowNull(true);
+ fieldSERIALNUMBER.setUnique(false);
+ table.addField(fieldSERIALNUMBER);
+
+ FieldDefinition fieldWHEELRIM = new FieldDefinition();
+ fieldWHEELRIM.setName("WHEELRIM_ID");
+ fieldWHEELRIM.setTypeName("NUMERIC");
+ fieldWHEELRIM.setSize(10);
+ fieldWHEELRIM.setSubSize(0);
+ fieldWHEELRIM.setIsPrimaryKey(false);
+ fieldWHEELRIM.setIsIdentity(false);
+ fieldWHEELRIM.setShouldAllowNull(true);
+ fieldWHEELRIM.setUnique(false);
+ table.addField(fieldWHEELRIM);
+
+ FieldDefinition fieldCHASSIS = new FieldDefinition();
+ fieldCHASSIS.setName("CHASSIS_ID");
+ fieldCHASSIS.setTypeName("NUMERIC");
+ fieldCHASSIS.setSize(10);
+ fieldCHASSIS.setSubSize(0);
+ fieldCHASSIS.setIsPrimaryKey(false);
+ fieldCHASSIS.setIsIdentity(false);
+ fieldCHASSIS.setShouldAllowNull(true);
+ fieldCHASSIS.setUnique(false);
+ table.addField(fieldCHASSIS);
+
+ FieldDefinition fieldMANUFACTURER = new FieldDefinition();
+ fieldMANUFACTURER.setName("MANUFACTURER");
+ fieldMANUFACTURER.setTypeName("VARCHAR");
+ fieldMANUFACTURER.setSize(60);
+ fieldMANUFACTURER.setSubSize(0);
+ fieldMANUFACTURER.setIsPrimaryKey(false);
+ fieldMANUFACTURER.setIsIdentity(false);
+ fieldMANUFACTURER.setShouldAllowNull(true);
+ fieldMANUFACTURER.setUnique(false);
+ table.addField(fieldMANUFACTURER);
+
+ FieldDefinition fieldTYPE = new FieldDefinition();
+ fieldTYPE.setName("TYPE");
+ fieldTYPE.setTypeName("VARCHAR");
+ fieldTYPE.setSize(60);
+ fieldTYPE.setSubSize(0);
+ fieldTYPE.setIsPrimaryKey(false);
+ fieldTYPE.setIsIdentity(false);
+ fieldTYPE.setShouldAllowNull(true);
+ fieldTYPE.setUnique(false);
+ table.addField(fieldTYPE);
+
+ // ALTER TABLE JPA_OR_WHEEL ADD CONSTRAINT FK_JPA_OR_WHEEL_WHEELRIM_ID FOREIGN KEY (WHEELRIM_ID) REFERENCES JPA_OR_WHEEL_RIM (ID)
+ ForeignKeyConstraint foreignKeyWHEEL_WHEELRIM = new ForeignKeyConstraint();
+ foreignKeyWHEEL_WHEELRIM.setName("FK_WHL_WHLRM_ID");
+ foreignKeyWHEEL_WHEELRIM.setTargetTable("JPA_OR_WHEEL_RIM");
+ foreignKeyWHEEL_WHEELRIM.addSourceField("WHEELRIM_ID");
+ foreignKeyWHEEL_WHEELRIM.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyWHEEL_WHEELRIM);
+
+ // ALTER TABLE JPA_OR_WHEEL ADD CONSTRAINT FK_JPA_OR_WHEEL_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES JPA_OR_CHASSIS (ID)
+ ForeignKeyConstraint foreignKeyWHEEL_CHASSIS = new ForeignKeyConstraint();
+ foreignKeyWHEEL_CHASSIS.setName("FK_WHL_CHAS_ID");
+ foreignKeyWHEEL_CHASSIS.setTargetTable("JPA_OR_CHASSIS");
+ foreignKeyWHEEL_CHASSIS.addSourceField("CHASSIS_ID");
+ foreignKeyWHEEL_CHASSIS.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyWHEEL_CHASSIS);
+
+ return table;
+ }
+
+ public static TableDefinition buildWHEELRIMTable() {
+ // CREATE TABLE JPA_OR_WHEEL_RIM (ID NUMBER(10) NOT NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_WHEEL_RIM");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public static TableDefinition buildWHEELNUTTable() {
+ // CREATE TABLE JPA_OR_WHEEL_NUT (ID NUMBER(10) NOT NULL, WHEEL_ID NUMBER(10) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("JPA_OR_WHEEL_NUT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldWHEEL = new FieldDefinition();
+ fieldWHEEL.setName("WHEEL_ID");
+ fieldWHEEL.setTypeName("NUMERIC");
+ fieldWHEEL.setSize(10);
+ fieldWHEEL.setSubSize(0);
+ fieldWHEEL.setIsPrimaryKey(false);
+ fieldWHEEL.setIsIdentity(false);
+ fieldWHEEL.setShouldAllowNull(true);
+ fieldWHEEL.setUnique(false);
+ table.addField(fieldWHEEL);
+
+ // ALTER TABLE JPA_OR_WHEEL_NUT ADD CONSTRAINT FK_JPA_OR_WHEEL_NUT_WHEEL_ID FOREIGN KEY (WHEEL_ID) REFERENCES JPA_OR_WHEEL (ID)
+ ForeignKeyConstraint foreignKeyWHEELNUT_WHEEL = new ForeignKeyConstraint();
+ foreignKeyWHEELNUT_WHEEL.setName("FK_WH_NUT_WL_ID");
+ foreignKeyWHEELNUT_WHEEL.setTargetTable("JPA_OR_WHEEL");
+ foreignKeyWHEELNUT_WHEEL.addSourceField("WHEEL_ID");
+ foreignKeyWHEELNUT_WHEEL.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyWHEELNUT_WHEEL);
+
+ return table;
+ }
+
+ /**
+ * Dropping old foreign keys from schema change.
+ */
+ @Override
+ public void replaceTables(DatabaseSession session) {
+ if (session.getPlatform().supportsUniqueKeyConstraints()
+ && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
+ try {
+ if (session.getPlatform().isMySQL()) {
+ session.executeNonSelectingSQL("Alter table JPA_OR_SPARK_PLUG drop foreign key JPA_OR_SPARK_PLUG_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_VEHICLE drop foreign key FK_JPA_OR_VEHICLE_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_VEHICLE drop foreign key FK_JPA_OR_VEHICLE_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL drop foreign key FK_JPA_OR_WHEEL_WHEELRIM_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL drop foreign key FK_JPA_OR_WHEEL_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL_NUT drop foreign key FK_JPA_OR_WHEEL_NUT_WHEEL_ID");
+ } else {
+ session.executeNonSelectingSQL("Alter table JPA_OR_SPARK_PLUG drop constraint JPA_OR_SPARK_PLUG_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_VEHICLE drop constraint FK_JPA_OR_VEHICLE_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_VEHICLE drop constraint FK_JPA_OR_VEHICLE_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL drop constraint FK_JPA_OR_WHEEL_WHEELRIM_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL drop constraint FK_JPA_OR_WHEEL_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table JPA_OR_WHEEL_NUT drop constraint FK_JPA_OR_WHEEL_NUT_WHEEL_ID");
+ }
+ } catch (Exception ignore) {}
+ }
+ super.replaceTables(session);
+ }
+
+}
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/privateowned/PrivateOwnedModelTableCreator.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/privateowned/PrivateOwnedModelTableCreator.java
index fc8cd45..b3ae4e9 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/privateowned/PrivateOwnedModelTableCreator.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/privateowned/PrivateOwnedModelTableCreator.java
@@ -1,462 +1,471 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * 02/26/09 dminsky - initial API and implementation
- ******************************************************************************/
-package org.eclipse.persistence.testing.models.jpa.privateowned;
-
-import org.eclipse.persistence.sessions.DatabaseSession;
-import org.eclipse.persistence.tools.schemaframework.*;
-
-public class PrivateOwnedModelTableCreator extends TableCreator {
-
- public PrivateOwnedModelTableCreator() {
- setName("EJB3PrivateOwnedModelTableCreator");
- addTableDefinition(buildVEHICLETable());
- addTableDefinition(buildCHASSISTable());
- addTableDefinition(buildMOUNTTable());
- addTableDefinition(buildENGINETable());
- addTableDefinition(buildSPARKPLUGTable());
- addTableDefinition(buildWHEELTable());
- addTableDefinition(buildWHEELRIMTable());
- addTableDefinition(buildWHEELNUTTable());
- }
-
- public static TableDefinition buildCHASSISTable() {
- // CREATE TABLE CMP3_PO_CHASSIS (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_CHASSIS");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition serialNumber = new FieldDefinition();
- serialNumber.setName("SERIALNUMBER");
- serialNumber.setTypeName("NUMERIC");
- serialNumber.setSize(18);
- serialNumber.setSubSize(0);
- serialNumber.setIsPrimaryKey(false);
- serialNumber.setIsIdentity(false);
- serialNumber.setShouldAllowNull(true);
- serialNumber.setUnique(false);
- table.addField(serialNumber);
-
- return table;
- }
-
- public static TableDefinition buildVEHICLETable() {
- // CREATE TABLE CMP3_PO_VEHICLE (ID NUMBER(10) NOT NULL, MODEL VARCHAR2(255) NULL, CHASSIS_ID NUMBER(10) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
-
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_VEHICLE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldMODEL = new FieldDefinition();
- fieldMODEL.setName("MODEL");
- fieldMODEL.setTypeName("VARCHAR");
- fieldMODEL.setSize(60);
- fieldMODEL.setSubSize(0);
- fieldMODEL.setIsPrimaryKey(false);
- fieldMODEL.setIsIdentity(false);
- fieldMODEL.setShouldAllowNull(true);
- fieldMODEL.setUnique(false);
- table.addField(fieldMODEL);
-
- FieldDefinition fieldDTYPE = new FieldDefinition();
- fieldDTYPE.setName("DTYPE");
- fieldDTYPE.setTypeName("VARCHAR");
- fieldDTYPE.setSize(60);
- fieldDTYPE.setSubSize(0);
- fieldDTYPE.setIsPrimaryKey(false);
- fieldDTYPE.setIsIdentity(false);
- fieldDTYPE.setShouldAllowNull(true);
- fieldDTYPE.setUnique(false);
- table.addField(fieldDTYPE);
-
- FieldDefinition fieldCHASSIS = new FieldDefinition();
- fieldCHASSIS.setName("CHASSIS_ID");
- fieldCHASSIS.setTypeName("NUMERIC");
- fieldCHASSIS.setSize(10);
- fieldCHASSIS.setSubSize(0);
- fieldCHASSIS.setIsPrimaryKey(false);
- fieldCHASSIS.setIsIdentity(false);
- fieldCHASSIS.setShouldAllowNull(true);
- fieldCHASSIS.setUnique(false);
- table.addField(fieldCHASSIS);
-
- FieldDefinition fieldENGINE = new FieldDefinition();
- fieldENGINE.setName("ENGINE_ID");
- fieldENGINE.setTypeName("NUMERIC");
- fieldENGINE.setSize(10);
- fieldENGINE.setSubSize(0);
- fieldENGINE.setIsPrimaryKey(false);
- fieldENGINE.setIsIdentity(false);
- fieldENGINE.setShouldAllowNull(true);
- fieldENGINE.setUnique(false);
- table.addField(fieldENGINE);
-
- // ALTER TABLE CMP3_PO_VEHICLE ADD CONSTRAINT FK_CMP3_PO_VEHICLE_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES CMP3_PO_ENGINE (ID)
- ForeignKeyConstraint foreignKeyVEHICLE_ENGINE = new ForeignKeyConstraint();
- foreignKeyVEHICLE_ENGINE.setName("FK_PO_VEH_ENG_ID");
- foreignKeyVEHICLE_ENGINE.setTargetTable("CMP3_PO_ENGINE");
- foreignKeyVEHICLE_ENGINE.addSourceField("ENGINE_ID");
- foreignKeyVEHICLE_ENGINE.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyVEHICLE_ENGINE);
-
- // ALTER TABLE CMP3_PO_VEHICLE ADD CONSTRAINT FK_CMP3_PO_VEHICLE_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES CMP3_PO_CHASSIS (ID)
- ForeignKeyConstraint foreignKeyVEHICLE_CHASSIS = new ForeignKeyConstraint();
- foreignKeyVEHICLE_CHASSIS.setName("FK_PO_VEH_CHAS_ID");
- foreignKeyVEHICLE_CHASSIS.setTargetTable("CMP3_PO_CHASSIS");
- foreignKeyVEHICLE_CHASSIS.addSourceField("CHASSIS_ID");
- foreignKeyVEHICLE_CHASSIS.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyVEHICLE_CHASSIS);
-
- return table;
- }
-
- public static TableDefinition buildENGINETable() {
- // CREATE TABLE CMP3_PO_ENGINE (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_ENGINE");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
- fieldSERIALNUMBER.setName("SERIALNUMBER");
- fieldSERIALNUMBER.setTypeName("NUMERIC");
- fieldSERIALNUMBER.setSize(18);
- fieldSERIALNUMBER.setSubSize(0);
- fieldSERIALNUMBER.setIsPrimaryKey(false);
- fieldSERIALNUMBER.setIsIdentity(false);
- fieldSERIALNUMBER.setShouldAllowNull(true);
- fieldSERIALNUMBER.setUnique(false);
- table.addField(fieldSERIALNUMBER);
-
- FieldDefinition fieldVersion = new FieldDefinition();
- fieldVersion.setName("VERSION");
- fieldVersion.setTypeName("NUMERIC");
- fieldVersion.setSize(15);
- fieldVersion.setShouldAllowNull(true);
- fieldVersion.setIsPrimaryKey(false);
- fieldVersion.setUnique(false);
- fieldVersion.setIsIdentity(false);
- table.addField(fieldVersion);
-
- return table;
- }
-
- public static TableDefinition buildMOUNTTable() {
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_MOUNT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldCHASSIS_ID = new FieldDefinition();
- fieldCHASSIS_ID.setName("ID2");
- fieldCHASSIS_ID.setTypeName("NUMERIC");
- fieldCHASSIS_ID.setSize(10);
- fieldCHASSIS_ID.setSubSize(0);
- fieldCHASSIS_ID.setIsPrimaryKey(true);
- fieldCHASSIS_ID.setIsIdentity(true);
- fieldCHASSIS_ID.setShouldAllowNull(false);
- fieldCHASSIS_ID.setUnique(false);
- table.addField(fieldCHASSIS_ID);
-
- FieldDefinition fieldVEHICLE_ID = new FieldDefinition();
- fieldVEHICLE_ID.setName("VEHICLE_ID");
- fieldVEHICLE_ID.setTypeName("NUMERIC");
- fieldVEHICLE_ID.setSize(10);
- fieldVEHICLE_ID.setSubSize(0);
- fieldVEHICLE_ID.setIsPrimaryKey(false);
- fieldVEHICLE_ID.setIsIdentity(false);
- fieldVEHICLE_ID.setShouldAllowNull(false);
- fieldVEHICLE_ID.setUnique(false);
- table.addField(fieldVEHICLE_ID);
-
- ForeignKeyConstraint foreignKeyMOUNT_VEHICLE = new ForeignKeyConstraint();
- foreignKeyMOUNT_VEHICLE.setName("PO_MOUNT_VEH_ID");
- foreignKeyMOUNT_VEHICLE.setTargetTable("CMP3_PO_VEHICLE");
- foreignKeyMOUNT_VEHICLE.addSourceField("VEHICLE_ID");
- foreignKeyMOUNT_VEHICLE.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyMOUNT_VEHICLE);
-
- ForeignKeyConstraint foreignKeyMOUNT_CHASSIS = new ForeignKeyConstraint();
- foreignKeyMOUNT_CHASSIS.setName("PO_MOUNT_CHA_ID");
- foreignKeyMOUNT_CHASSIS.setTargetTable("CMP3_PO_CHASSIS");
- foreignKeyMOUNT_CHASSIS.addSourceField("ID2");
- foreignKeyMOUNT_CHASSIS.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyMOUNT_CHASSIS);
-
- return table;
- }
-
- public static TableDefinition buildSPARKPLUGTable() {
- // CREATE TABLE CMP3_PO_SPARK_PLUG (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_SPARK_PLUG");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
- fieldSERIALNUMBER.setName("SERIALNUMBER");
- fieldSERIALNUMBER.setTypeName("NUMERIC");
- fieldSERIALNUMBER.setSize(18);
- fieldSERIALNUMBER.setSubSize(0);
- fieldSERIALNUMBER.setIsPrimaryKey(false);
- fieldSERIALNUMBER.setIsIdentity(false);
- fieldSERIALNUMBER.setShouldAllowNull(true);
- fieldSERIALNUMBER.setUnique(false);
- table.addField(fieldSERIALNUMBER);
-
- FieldDefinition fieldENGINE = new FieldDefinition();
- fieldENGINE.setName("ENGINE_ID");
- fieldENGINE.setTypeName("NUMERIC");
- fieldENGINE.setSize(10);
- fieldENGINE.setSubSize(0);
- fieldENGINE.setIsPrimaryKey(false);
- fieldENGINE.setIsIdentity(false);
- fieldENGINE.setShouldAllowNull(true);
- fieldENGINE.setUnique(false);
- table.addField(fieldENGINE);
-
- FieldDefinition fieldVersion = new FieldDefinition();
- fieldVersion.setName("VERSION");
- fieldVersion.setTypeName("NUMERIC");
- fieldVersion.setSize(15);
- fieldVersion.setShouldAllowNull(true);
- fieldVersion.setIsPrimaryKey(false);
- fieldVersion.setUnique(false);
- fieldVersion.setIsIdentity(false);
- table.addField(fieldVersion);
-
- // ALTER TABLE CMP3_PO_SPARK_PLUG ADD CONSTRAINT CMP3_PO_SPARK_PLUG_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES CMP3_PO_ENGINE (ID)
- ForeignKeyConstraint foreignKeySPARKPLUG_ENGINE = new ForeignKeyConstraint();
- foreignKeySPARKPLUG_ENGINE.setName("PO_SPK_PG_ENG_ID");
- foreignKeySPARKPLUG_ENGINE.setTargetTable("CMP3_PO_ENGINE");
- foreignKeySPARKPLUG_ENGINE.addSourceField("ENGINE_ID");
- foreignKeySPARKPLUG_ENGINE.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeySPARKPLUG_ENGINE);
-
- return table;
- }
-
- public static TableDefinition buildWHEELTable() {
- // CREATE TABLE CMP3_PO_WHEEL (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, WHEELRIM_ID NUMBER(10) NULL,
- // CHASSIS_ID NUMBER(10) NULL, MANUFACTURER VARCHAR2(255) NULL, TYPE VARCHAR2(255) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_WHEEL");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
- fieldSERIALNUMBER.setName("SERIALNUMBER");
- fieldSERIALNUMBER.setTypeName("NUMERIC");
- fieldSERIALNUMBER.setSize(18);
- fieldSERIALNUMBER.setSubSize(0);
- fieldSERIALNUMBER.setIsPrimaryKey(false);
- fieldSERIALNUMBER.setIsIdentity(false);
- fieldSERIALNUMBER.setShouldAllowNull(true);
- fieldSERIALNUMBER.setUnique(false);
- table.addField(fieldSERIALNUMBER);
-
- FieldDefinition fieldWHEELRIM = new FieldDefinition();
- fieldWHEELRIM.setName("WHEELRIM_ID");
- fieldWHEELRIM.setTypeName("NUMERIC");
- fieldWHEELRIM.setSize(10);
- fieldWHEELRIM.setSubSize(0);
- fieldWHEELRIM.setIsPrimaryKey(false);
- fieldWHEELRIM.setIsIdentity(false);
- fieldWHEELRIM.setShouldAllowNull(true);
- fieldWHEELRIM.setUnique(false);
- table.addField(fieldWHEELRIM);
-
- FieldDefinition fieldCHASSIS = new FieldDefinition();
- fieldCHASSIS.setName("CHASSIS_ID");
- fieldCHASSIS.setTypeName("NUMERIC");
- fieldCHASSIS.setSize(10);
- fieldCHASSIS.setSubSize(0);
- fieldCHASSIS.setIsPrimaryKey(false);
- fieldCHASSIS.setIsIdentity(false);
- fieldCHASSIS.setShouldAllowNull(true);
- fieldCHASSIS.setUnique(false);
- table.addField(fieldCHASSIS);
-
- FieldDefinition fieldMANUFACTURER = new FieldDefinition();
- fieldMANUFACTURER.setName("MANUFACTURER");
- fieldMANUFACTURER.setTypeName("VARCHAR");
- fieldMANUFACTURER.setSize(60);
- fieldMANUFACTURER.setSubSize(0);
- fieldMANUFACTURER.setIsPrimaryKey(false);
- fieldMANUFACTURER.setIsIdentity(false);
- fieldMANUFACTURER.setShouldAllowNull(true);
- fieldMANUFACTURER.setUnique(false);
- table.addField(fieldMANUFACTURER);
-
- FieldDefinition fieldTYPE = new FieldDefinition();
- fieldTYPE.setName("TYPE");
- fieldTYPE.setTypeName("VARCHAR");
- fieldTYPE.setSize(60);
- fieldTYPE.setSubSize(0);
- fieldTYPE.setIsPrimaryKey(false);
- fieldTYPE.setIsIdentity(false);
- fieldTYPE.setShouldAllowNull(true);
- fieldTYPE.setUnique(false);
- table.addField(fieldTYPE);
-
- // ALTER TABLE CMP3_PO_WHEEL ADD CONSTRAINT FK_CMP3_PO_WHEEL_WHEELRIM_ID FOREIGN KEY (WHEELRIM_ID) REFERENCES CMP3_PO_WHEEL_RIM (ID)
- ForeignKeyConstraint foreignKeyWHEEL_WHEELRIM = new ForeignKeyConstraint();
- foreignKeyWHEEL_WHEELRIM.setName("FK_WL_WLRM_ID");
- foreignKeyWHEEL_WHEELRIM.setTargetTable("CMP3_PO_WHEEL_RIM");
- foreignKeyWHEEL_WHEELRIM.addSourceField("WHEELRIM_ID");
- foreignKeyWHEEL_WHEELRIM.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyWHEEL_WHEELRIM);
-
- // ALTER TABLE CMP3_PO_WHEEL ADD CONSTRAINT FK_CMP3_PO_WHEEL_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES CMP3_PO_CHASSIS (ID)
- ForeignKeyConstraint foreignKeyWHEEL_CHASSIS = new ForeignKeyConstraint();
- foreignKeyWHEEL_CHASSIS.setName("FK_WEL_CHAS_ID");
- foreignKeyWHEEL_CHASSIS.setTargetTable("CMP3_PO_CHASSIS");
- foreignKeyWHEEL_CHASSIS.addSourceField("CHASSIS_ID");
- foreignKeyWHEEL_CHASSIS.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyWHEEL_CHASSIS);
-
- return table;
- }
-
- public static TableDefinition buildWHEELRIMTable() {
- // CREATE TABLE CMP3_PO_WHEEL_RIM (ID NUMBER(10) NOT NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_WHEEL_RIM");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- return table;
- }
-
- public static TableDefinition buildWHEELNUTTable() {
- // CREATE TABLE CMP3_PO_WHEEL_NUT (ID NUMBER(10) NOT NULL, WHEEL_ID NUMBER(10) NULL, PRIMARY KEY (ID))
- TableDefinition table = new TableDefinition();
- table.setName("CMP3_PO_WHEEL_NUT");
-
- FieldDefinition fieldID = new FieldDefinition();
- fieldID.setName("ID");
- fieldID.setTypeName("NUMERIC");
- fieldID.setSize(10);
- fieldID.setSubSize(0);
- fieldID.setIsPrimaryKey(true);
- fieldID.setIsIdentity(true);
- fieldID.setShouldAllowNull(false);
- fieldID.setUnique(false);
- table.addField(fieldID);
-
- FieldDefinition fieldWHEEL = new FieldDefinition();
- fieldWHEEL.setName("WHEEL_ID");
- fieldWHEEL.setTypeName("NUMERIC");
- fieldWHEEL.setSize(10);
- fieldWHEEL.setSubSize(0);
- fieldWHEEL.setIsPrimaryKey(false);
- fieldWHEEL.setIsIdentity(false);
- fieldWHEEL.setShouldAllowNull(true);
- fieldWHEEL.setUnique(false);
- table.addField(fieldWHEEL);
-
- // ALTER TABLE CMP3_PO_WHEEL_NUT ADD CONSTRAINT FK_CMP3_PO_WHEEL_NUT_WHEEL_ID FOREIGN KEY (WHEEL_ID) REFERENCES CMP3_PO_WHEEL (ID)
- ForeignKeyConstraint foreignKeyWHEELNUT_WHEEL = new ForeignKeyConstraint();
- foreignKeyWHEELNUT_WHEEL.setName("FK_WL_NUT_WHL_ID");
- foreignKeyWHEELNUT_WHEEL.setTargetTable("CMP3_PO_WHEEL");
- foreignKeyWHEELNUT_WHEEL.addSourceField("WHEEL_ID");
- foreignKeyWHEELNUT_WHEEL.addTargetField("ID");
- table.addForeignKeyConstraint(foreignKeyWHEELNUT_WHEEL);
-
- return table;
- }
-
- /**
- * Dropping old foreign keys from schema change.
- */
- @Override
- public void replaceTables(DatabaseSession session) {
- if (session.getPlatform().supportsUniqueKeyConstraints()
- && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
- try {
- session.executeNonSelectingSQL("Alter table CMP3_PO_SPARK_PLUG drop constraint CMP3_PO_SPARK_PLUG_ENGINE_ID");
- session.executeNonSelectingSQL("Alter table CMP3_PO_VEHICLE drop constraint FK_CMP3_PO_VEHICLE_ENGINE_ID");
- session.executeNonSelectingSQL("Alter table CMP3_PO_VEHICLE drop constraint FK_CMP3_PO_VEHICLE_CHASSIS_ID");
- session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL drop constraint FK_CMP3_PO_WHEEL_WHEELRIM_ID");
- session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL drop constraint FK_CMP3_PO_WHEEL_CHASSIS_ID");
- session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL_NUT drop constraint FK_CMP3_PO_WHEEL_NUT_WHEEL_ID");
- } catch (Exception ignore) {}
- }
- super.replaceTables(session);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * 02/26/09 dminsky - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.jpa.privateowned;
+
+import org.eclipse.persistence.sessions.DatabaseSession;
+import org.eclipse.persistence.tools.schemaframework.*;
+
+public class PrivateOwnedModelTableCreator extends TableCreator {
+
+ public PrivateOwnedModelTableCreator() {
+ setName("EJB3PrivateOwnedModelTableCreator");
+ addTableDefinition(buildVEHICLETable());
+ addTableDefinition(buildCHASSISTable());
+ addTableDefinition(buildMOUNTTable());
+ addTableDefinition(buildENGINETable());
+ addTableDefinition(buildSPARKPLUGTable());
+ addTableDefinition(buildWHEELTable());
+ addTableDefinition(buildWHEELRIMTable());
+ addTableDefinition(buildWHEELNUTTable());
+ }
+
+ public static TableDefinition buildCHASSISTable() {
+ // CREATE TABLE CMP3_PO_CHASSIS (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_CHASSIS");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition serialNumber = new FieldDefinition();
+ serialNumber.setName("SERIALNUMBER");
+ serialNumber.setTypeName("NUMERIC");
+ serialNumber.setSize(18);
+ serialNumber.setSubSize(0);
+ serialNumber.setIsPrimaryKey(false);
+ serialNumber.setIsIdentity(false);
+ serialNumber.setShouldAllowNull(true);
+ serialNumber.setUnique(false);
+ table.addField(serialNumber);
+
+ return table;
+ }
+
+ public static TableDefinition buildVEHICLETable() {
+ // CREATE TABLE CMP3_PO_VEHICLE (ID NUMBER(10) NOT NULL, MODEL VARCHAR2(255) NULL, CHASSIS_ID NUMBER(10) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
+
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_VEHICLE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldMODEL = new FieldDefinition();
+ fieldMODEL.setName("MODEL");
+ fieldMODEL.setTypeName("VARCHAR");
+ fieldMODEL.setSize(60);
+ fieldMODEL.setSubSize(0);
+ fieldMODEL.setIsPrimaryKey(false);
+ fieldMODEL.setIsIdentity(false);
+ fieldMODEL.setShouldAllowNull(true);
+ fieldMODEL.setUnique(false);
+ table.addField(fieldMODEL);
+
+ FieldDefinition fieldDTYPE = new FieldDefinition();
+ fieldDTYPE.setName("DTYPE");
+ fieldDTYPE.setTypeName("VARCHAR");
+ fieldDTYPE.setSize(60);
+ fieldDTYPE.setSubSize(0);
+ fieldDTYPE.setIsPrimaryKey(false);
+ fieldDTYPE.setIsIdentity(false);
+ fieldDTYPE.setShouldAllowNull(true);
+ fieldDTYPE.setUnique(false);
+ table.addField(fieldDTYPE);
+
+ FieldDefinition fieldCHASSIS = new FieldDefinition();
+ fieldCHASSIS.setName("CHASSIS_ID");
+ fieldCHASSIS.setTypeName("NUMERIC");
+ fieldCHASSIS.setSize(10);
+ fieldCHASSIS.setSubSize(0);
+ fieldCHASSIS.setIsPrimaryKey(false);
+ fieldCHASSIS.setIsIdentity(false);
+ fieldCHASSIS.setShouldAllowNull(true);
+ fieldCHASSIS.setUnique(false);
+ table.addField(fieldCHASSIS);
+
+ FieldDefinition fieldENGINE = new FieldDefinition();
+ fieldENGINE.setName("ENGINE_ID");
+ fieldENGINE.setTypeName("NUMERIC");
+ fieldENGINE.setSize(10);
+ fieldENGINE.setSubSize(0);
+ fieldENGINE.setIsPrimaryKey(false);
+ fieldENGINE.setIsIdentity(false);
+ fieldENGINE.setShouldAllowNull(true);
+ fieldENGINE.setUnique(false);
+ table.addField(fieldENGINE);
+
+ // ALTER TABLE CMP3_PO_VEHICLE ADD CONSTRAINT FK_CMP3_PO_VEHICLE_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES CMP3_PO_ENGINE (ID)
+ ForeignKeyConstraint foreignKeyVEHICLE_ENGINE = new ForeignKeyConstraint();
+ foreignKeyVEHICLE_ENGINE.setName("FK_PO_VEH_ENG_ID");
+ foreignKeyVEHICLE_ENGINE.setTargetTable("CMP3_PO_ENGINE");
+ foreignKeyVEHICLE_ENGINE.addSourceField("ENGINE_ID");
+ foreignKeyVEHICLE_ENGINE.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyVEHICLE_ENGINE);
+
+ // ALTER TABLE CMP3_PO_VEHICLE ADD CONSTRAINT FK_CMP3_PO_VEHICLE_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES CMP3_PO_CHASSIS (ID)
+ ForeignKeyConstraint foreignKeyVEHICLE_CHASSIS = new ForeignKeyConstraint();
+ foreignKeyVEHICLE_CHASSIS.setName("FK_PO_VEH_CHAS_ID");
+ foreignKeyVEHICLE_CHASSIS.setTargetTable("CMP3_PO_CHASSIS");
+ foreignKeyVEHICLE_CHASSIS.addSourceField("CHASSIS_ID");
+ foreignKeyVEHICLE_CHASSIS.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyVEHICLE_CHASSIS);
+
+ return table;
+ }
+
+ public static TableDefinition buildENGINETable() {
+ // CREATE TABLE CMP3_PO_ENGINE (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_ENGINE");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
+ fieldSERIALNUMBER.setName("SERIALNUMBER");
+ fieldSERIALNUMBER.setTypeName("NUMERIC");
+ fieldSERIALNUMBER.setSize(18);
+ fieldSERIALNUMBER.setSubSize(0);
+ fieldSERIALNUMBER.setIsPrimaryKey(false);
+ fieldSERIALNUMBER.setIsIdentity(false);
+ fieldSERIALNUMBER.setShouldAllowNull(true);
+ fieldSERIALNUMBER.setUnique(false);
+ table.addField(fieldSERIALNUMBER);
+
+ FieldDefinition fieldVersion = new FieldDefinition();
+ fieldVersion.setName("VERSION");
+ fieldVersion.setTypeName("NUMERIC");
+ fieldVersion.setSize(15);
+ fieldVersion.setShouldAllowNull(true);
+ fieldVersion.setIsPrimaryKey(false);
+ fieldVersion.setUnique(false);
+ fieldVersion.setIsIdentity(false);
+ table.addField(fieldVersion);
+
+ return table;
+ }
+
+ public static TableDefinition buildMOUNTTable() {
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_MOUNT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldCHASSIS_ID = new FieldDefinition();
+ fieldCHASSIS_ID.setName("ID2");
+ fieldCHASSIS_ID.setTypeName("NUMERIC");
+ fieldCHASSIS_ID.setSize(10);
+ fieldCHASSIS_ID.setSubSize(0);
+ fieldCHASSIS_ID.setIsPrimaryKey(true);
+ fieldCHASSIS_ID.setIsIdentity(true);
+ fieldCHASSIS_ID.setShouldAllowNull(false);
+ fieldCHASSIS_ID.setUnique(false);
+ table.addField(fieldCHASSIS_ID);
+
+ FieldDefinition fieldVEHICLE_ID = new FieldDefinition();
+ fieldVEHICLE_ID.setName("VEHICLE_ID");
+ fieldVEHICLE_ID.setTypeName("NUMERIC");
+ fieldVEHICLE_ID.setSize(10);
+ fieldVEHICLE_ID.setSubSize(0);
+ fieldVEHICLE_ID.setIsPrimaryKey(false);
+ fieldVEHICLE_ID.setIsIdentity(false);
+ fieldVEHICLE_ID.setShouldAllowNull(false);
+ fieldVEHICLE_ID.setUnique(false);
+ table.addField(fieldVEHICLE_ID);
+
+ ForeignKeyConstraint foreignKeyMOUNT_VEHICLE = new ForeignKeyConstraint();
+ foreignKeyMOUNT_VEHICLE.setName("PO_MOUNT_VEH_ID");
+ foreignKeyMOUNT_VEHICLE.setTargetTable("CMP3_PO_VEHICLE");
+ foreignKeyMOUNT_VEHICLE.addSourceField("VEHICLE_ID");
+ foreignKeyMOUNT_VEHICLE.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyMOUNT_VEHICLE);
+
+ ForeignKeyConstraint foreignKeyMOUNT_CHASSIS = new ForeignKeyConstraint();
+ foreignKeyMOUNT_CHASSIS.setName("PO_MOUNT_CHA_ID");
+ foreignKeyMOUNT_CHASSIS.setTargetTable("CMP3_PO_CHASSIS");
+ foreignKeyMOUNT_CHASSIS.addSourceField("ID2");
+ foreignKeyMOUNT_CHASSIS.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyMOUNT_CHASSIS);
+
+ return table;
+ }
+
+ public static TableDefinition buildSPARKPLUGTable() {
+ // CREATE TABLE CMP3_PO_SPARK_PLUG (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, ENGINE_ID NUMBER(10) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_SPARK_PLUG");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
+ fieldSERIALNUMBER.setName("SERIALNUMBER");
+ fieldSERIALNUMBER.setTypeName("NUMERIC");
+ fieldSERIALNUMBER.setSize(18);
+ fieldSERIALNUMBER.setSubSize(0);
+ fieldSERIALNUMBER.setIsPrimaryKey(false);
+ fieldSERIALNUMBER.setIsIdentity(false);
+ fieldSERIALNUMBER.setShouldAllowNull(true);
+ fieldSERIALNUMBER.setUnique(false);
+ table.addField(fieldSERIALNUMBER);
+
+ FieldDefinition fieldENGINE = new FieldDefinition();
+ fieldENGINE.setName("ENGINE_ID");
+ fieldENGINE.setTypeName("NUMERIC");
+ fieldENGINE.setSize(10);
+ fieldENGINE.setSubSize(0);
+ fieldENGINE.setIsPrimaryKey(false);
+ fieldENGINE.setIsIdentity(false);
+ fieldENGINE.setShouldAllowNull(true);
+ fieldENGINE.setUnique(false);
+ table.addField(fieldENGINE);
+
+ FieldDefinition fieldVersion = new FieldDefinition();
+ fieldVersion.setName("VERSION");
+ fieldVersion.setTypeName("NUMERIC");
+ fieldVersion.setSize(15);
+ fieldVersion.setShouldAllowNull(true);
+ fieldVersion.setIsPrimaryKey(false);
+ fieldVersion.setUnique(false);
+ fieldVersion.setIsIdentity(false);
+ table.addField(fieldVersion);
+
+ // ALTER TABLE CMP3_PO_SPARK_PLUG ADD CONSTRAINT CMP3_PO_SPARK_PLUG_ENGINE_ID FOREIGN KEY (ENGINE_ID) REFERENCES CMP3_PO_ENGINE (ID)
+ ForeignKeyConstraint foreignKeySPARKPLUG_ENGINE = new ForeignKeyConstraint();
+ foreignKeySPARKPLUG_ENGINE.setName("PO_SPK_PG_ENG_ID");
+ foreignKeySPARKPLUG_ENGINE.setTargetTable("CMP3_PO_ENGINE");
+ foreignKeySPARKPLUG_ENGINE.addSourceField("ENGINE_ID");
+ foreignKeySPARKPLUG_ENGINE.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeySPARKPLUG_ENGINE);
+
+ return table;
+ }
+
+ public static TableDefinition buildWHEELTable() {
+ // CREATE TABLE CMP3_PO_WHEEL (ID NUMBER(10) NOT NULL, SERIALNUMBER NUMBER(19) NULL, WHEELRIM_ID NUMBER(10) NULL,
+ // CHASSIS_ID NUMBER(10) NULL, MANUFACTURER VARCHAR2(255) NULL, TYPE VARCHAR2(255) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_WHEEL");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldSERIALNUMBER = new FieldDefinition();
+ fieldSERIALNUMBER.setName("SERIALNUMBER");
+ fieldSERIALNUMBER.setTypeName("NUMERIC");
+ fieldSERIALNUMBER.setSize(18);
+ fieldSERIALNUMBER.setSubSize(0);
+ fieldSERIALNUMBER.setIsPrimaryKey(false);
+ fieldSERIALNUMBER.setIsIdentity(false);
+ fieldSERIALNUMBER.setShouldAllowNull(true);
+ fieldSERIALNUMBER.setUnique(false);
+ table.addField(fieldSERIALNUMBER);
+
+ FieldDefinition fieldWHEELRIM = new FieldDefinition();
+ fieldWHEELRIM.setName("WHEELRIM_ID");
+ fieldWHEELRIM.setTypeName("NUMERIC");
+ fieldWHEELRIM.setSize(10);
+ fieldWHEELRIM.setSubSize(0);
+ fieldWHEELRIM.setIsPrimaryKey(false);
+ fieldWHEELRIM.setIsIdentity(false);
+ fieldWHEELRIM.setShouldAllowNull(true);
+ fieldWHEELRIM.setUnique(false);
+ table.addField(fieldWHEELRIM);
+
+ FieldDefinition fieldCHASSIS = new FieldDefinition();
+ fieldCHASSIS.setName("CHASSIS_ID");
+ fieldCHASSIS.setTypeName("NUMERIC");
+ fieldCHASSIS.setSize(10);
+ fieldCHASSIS.setSubSize(0);
+ fieldCHASSIS.setIsPrimaryKey(false);
+ fieldCHASSIS.setIsIdentity(false);
+ fieldCHASSIS.setShouldAllowNull(true);
+ fieldCHASSIS.setUnique(false);
+ table.addField(fieldCHASSIS);
+
+ FieldDefinition fieldMANUFACTURER = new FieldDefinition();
+ fieldMANUFACTURER.setName("MANUFACTURER");
+ fieldMANUFACTURER.setTypeName("VARCHAR");
+ fieldMANUFACTURER.setSize(60);
+ fieldMANUFACTURER.setSubSize(0);
+ fieldMANUFACTURER.setIsPrimaryKey(false);
+ fieldMANUFACTURER.setIsIdentity(false);
+ fieldMANUFACTURER.setShouldAllowNull(true);
+ fieldMANUFACTURER.setUnique(false);
+ table.addField(fieldMANUFACTURER);
+
+ FieldDefinition fieldTYPE = new FieldDefinition();
+ fieldTYPE.setName("TYPE");
+ fieldTYPE.setTypeName("VARCHAR");
+ fieldTYPE.setSize(60);
+ fieldTYPE.setSubSize(0);
+ fieldTYPE.setIsPrimaryKey(false);
+ fieldTYPE.setIsIdentity(false);
+ fieldTYPE.setShouldAllowNull(true);
+ fieldTYPE.setUnique(false);
+ table.addField(fieldTYPE);
+
+ // ALTER TABLE CMP3_PO_WHEEL ADD CONSTRAINT FK_CMP3_PO_WHEEL_WHEELRIM_ID FOREIGN KEY (WHEELRIM_ID) REFERENCES CMP3_PO_WHEEL_RIM (ID)
+ ForeignKeyConstraint foreignKeyWHEEL_WHEELRIM = new ForeignKeyConstraint();
+ foreignKeyWHEEL_WHEELRIM.setName("FK_WL_WLRM_ID");
+ foreignKeyWHEEL_WHEELRIM.setTargetTable("CMP3_PO_WHEEL_RIM");
+ foreignKeyWHEEL_WHEELRIM.addSourceField("WHEELRIM_ID");
+ foreignKeyWHEEL_WHEELRIM.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyWHEEL_WHEELRIM);
+
+ // ALTER TABLE CMP3_PO_WHEEL ADD CONSTRAINT FK_CMP3_PO_WHEEL_CHASSIS_ID FOREIGN KEY (CHASSIS_ID) REFERENCES CMP3_PO_CHASSIS (ID)
+ ForeignKeyConstraint foreignKeyWHEEL_CHASSIS = new ForeignKeyConstraint();
+ foreignKeyWHEEL_CHASSIS.setName("FK_WEL_CHAS_ID");
+ foreignKeyWHEEL_CHASSIS.setTargetTable("CMP3_PO_CHASSIS");
+ foreignKeyWHEEL_CHASSIS.addSourceField("CHASSIS_ID");
+ foreignKeyWHEEL_CHASSIS.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyWHEEL_CHASSIS);
+
+ return table;
+ }
+
+ public static TableDefinition buildWHEELRIMTable() {
+ // CREATE TABLE CMP3_PO_WHEEL_RIM (ID NUMBER(10) NOT NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_WHEEL_RIM");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ return table;
+ }
+
+ public static TableDefinition buildWHEELNUTTable() {
+ // CREATE TABLE CMP3_PO_WHEEL_NUT (ID NUMBER(10) NOT NULL, WHEEL_ID NUMBER(10) NULL, PRIMARY KEY (ID))
+ TableDefinition table = new TableDefinition();
+ table.setName("CMP3_PO_WHEEL_NUT");
+
+ FieldDefinition fieldID = new FieldDefinition();
+ fieldID.setName("ID");
+ fieldID.setTypeName("NUMERIC");
+ fieldID.setSize(10);
+ fieldID.setSubSize(0);
+ fieldID.setIsPrimaryKey(true);
+ fieldID.setIsIdentity(true);
+ fieldID.setShouldAllowNull(false);
+ fieldID.setUnique(false);
+ table.addField(fieldID);
+
+ FieldDefinition fieldWHEEL = new FieldDefinition();
+ fieldWHEEL.setName("WHEEL_ID");
+ fieldWHEEL.setTypeName("NUMERIC");
+ fieldWHEEL.setSize(10);
+ fieldWHEEL.setSubSize(0);
+ fieldWHEEL.setIsPrimaryKey(false);
+ fieldWHEEL.setIsIdentity(false);
+ fieldWHEEL.setShouldAllowNull(true);
+ fieldWHEEL.setUnique(false);
+ table.addField(fieldWHEEL);
+
+ // ALTER TABLE CMP3_PO_WHEEL_NUT ADD CONSTRAINT FK_CMP3_PO_WHEEL_NUT_WHEEL_ID FOREIGN KEY (WHEEL_ID) REFERENCES CMP3_PO_WHEEL (ID)
+ ForeignKeyConstraint foreignKeyWHEELNUT_WHEEL = new ForeignKeyConstraint();
+ foreignKeyWHEELNUT_WHEEL.setName("FK_WL_NUT_WHL_ID");
+ foreignKeyWHEELNUT_WHEEL.setTargetTable("CMP3_PO_WHEEL");
+ foreignKeyWHEELNUT_WHEEL.addSourceField("WHEEL_ID");
+ foreignKeyWHEELNUT_WHEEL.addTargetField("ID");
+ table.addForeignKeyConstraint(foreignKeyWHEELNUT_WHEEL);
+
+ return table;
+ }
+
+ /**
+ * Dropping old foreign keys from schema change.
+ */
+ @Override
+ public void replaceTables(DatabaseSession session) {
+ if (session.getPlatform().supportsUniqueKeyConstraints()
+ && !session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
+ try {
+ if (session.getPlatform().isMySQL()) {
+ session.executeNonSelectingSQL("Alter table CMP3_PO_SPARK_PLUG drop foreign key CMP3_PO_SPARK_PLUG_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_VEHICLE drop foreign key FK_CMP3_PO_VEHICLE_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_VEHICLE drop foreign key FK_CMP3_PO_VEHICLE_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL drop foreign key FK_CMP3_PO_WHEEL_WHEELRIM_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL drop foreign key FK_CMP3_PO_WHEEL_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL_NUT drop foreign key FK_CMP3_PO_WHEEL_NUT_WHEEL_ID");
+ } else {
+ session.executeNonSelectingSQL("Alter table CMP3_PO_SPARK_PLUG drop constraint CMP3_PO_SPARK_PLUG_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_VEHICLE drop constraint FK_CMP3_PO_VEHICLE_ENGINE_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_VEHICLE drop constraint FK_CMP3_PO_VEHICLE_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL drop constraint FK_CMP3_PO_WHEEL_WHEELRIM_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL drop constraint FK_CMP3_PO_WHEEL_CHASSIS_ID");
+ session.executeNonSelectingSQL("Alter table CMP3_PO_WHEEL_NUT drop constraint FK_CMP3_PO_WHEEL_NUT_WHEEL_ID");
+ }
+ } catch (Exception ignore) {}
+ }
+ super.replaceTables(session);
+ }
+
+}