blob: 2fec110c4370705b3222b8b2421ad286259b393f [file] [log] [blame]
/*
* Copyright (c) 1998, 2020 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 v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// ailitchev - Uni-directional OneToMany
package org.eclipse.persistence.testing.models.unidirectional;
/**
* TopLink generated Project class.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
public class EmployeeTableCreator extends org.eclipse.persistence.tools.schemaframework.TableCreator {
/**
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
public EmployeeTableCreator() {
applyPROJECT();
buildEMPLOYEETable();
buildPHONETable();
}
/**
* TopLink generated method.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
protected void applyPROJECT() {
setName("UnidirectionalEmployee");
}
/**
* TopLink generated method.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
protected void buildEMPLOYEETable() {
org.eclipse.persistence.tools.schemaframework.TableDefinition tabledefinition = new org.eclipse.persistence.tools.schemaframework.TableDefinition();
// SECTION: TABLE
tabledefinition.setName("UNIDIR_EMPLOYEE");
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field.setName("EMP_ID");
field.setTypeName("NUMERIC");
field.setSize(15);
field.setShouldAllowNull(false);
field.setIsPrimaryKey(true);
field.setUnique(false);
field.setIsIdentity(true);
tabledefinition.addField(field);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field1 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field1.setName("F_NAME");
field1.setTypeName("VARCHAR");
field1.setSize(40);
field1.setShouldAllowNull(true);
field1.setIsPrimaryKey(false);
field1.setUnique(false);
field1.setIsIdentity(false);
tabledefinition.addField(field1);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field2 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field2.setName("L_NAME");
field2.setTypeName("VARCHAR");
field2.setSize(40);
field2.setShouldAllowNull(true);
field2.setIsPrimaryKey(false);
field2.setUnique(false);
field2.setIsIdentity(false);
tabledefinition.addField(field2);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field9 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field9.setName("MANAGER_ID");
field9.setTypeName("NUMERIC");
field9.setSize(15);
field9.setShouldAllowNull(true);
field9.setIsPrimaryKey(false);
field9.setUnique(false);
field9.setIsIdentity(false);
field9.setForeignKeyFieldName("UNIDIR_EMPLOYEE.EMP_ID");
tabledefinition.addField(field9);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field10 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field10.setName("VERSION");
field10.setTypeName("NUMERIC");
field10.setSize(15);
field10.setShouldAllowNull(true);
field10.setIsPrimaryKey(false);
field10.setUnique(false);
field10.setIsIdentity(false);
tabledefinition.addField(field10);
addTableDefinition(tabledefinition);
}
/**
* TopLink generated method.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
protected void buildPHONETable() {
org.eclipse.persistence.tools.schemaframework.TableDefinition tabledefinition = new org.eclipse.persistence.tools.schemaframework.TableDefinition();
// SECTION: TABLE
tabledefinition.setName("UNIDIR_PHONE");
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field.setName("EMP_ID");
field.setTypeName("NUMERIC");
field.setSize(15);
if(EmployeeProject.ownerIdIsInPK) {
field.setShouldAllowNull(false);
field.setIsPrimaryKey(true);
} else {
field.setShouldAllowNull(true);
field.setIsPrimaryKey(false);
}
field.setUnique(false);
field.setIsIdentity(false);
field.setForeignKeyFieldName("UNIDIR_EMPLOYEE.EMP_ID");
tabledefinition.addField(field);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field1 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field1.setName("TYPE");
field1.setTypeName("VARCHAR");
field1.setSize(15);
if(EmployeeProject.ownerIdIsInPK) {
field.setShouldAllowNull(false);
field.setIsPrimaryKey(true);
} else {
field1.setShouldAllowNull(true);
field1.setIsPrimaryKey(false);
}
field1.setUnique(false);
field1.setIsIdentity(false);
tabledefinition.addField(field1);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field2 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field2.setName("AREA_CODE");
field2.setTypeName("VARCHAR");
field2.setSize(3);
if(EmployeeProject.ownerIdIsInPK) {
field1.setShouldAllowNull(true);
field1.setIsPrimaryKey(false);
} else {
field2.setShouldAllowNull(false);
field2.setIsPrimaryKey(true);
}
field2.setUnique(false);
field2.setIsIdentity(false);
tabledefinition.addField(field2);
// SECTION: FIELD
org.eclipse.persistence.tools.schemaframework.FieldDefinition field3 = new org.eclipse.persistence.tools.schemaframework.FieldDefinition();
field3.setName("P_NUMBER");
field3.setTypeName("VARCHAR");
field3.setSize(7);
if(EmployeeProject.ownerIdIsInPK) {
field1.setShouldAllowNull(true);
field1.setIsPrimaryKey(false);
} else {
field3.setShouldAllowNull(false);
field3.setIsPrimaryKey(true);
}
field3.setUnique(false);
field3.setIsIdentity(false);
tabledefinition.addField(field3);
addTableDefinition(tabledefinition);
}
}