1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns; 23 24 import javax.persistence.PrimaryKeyJoinColumn; 25 26 import oracle.toplink.essentials.internal.helper.DatabaseField; 27 28 34 public class MetadataPrimaryKeyJoinColumn { 35 protected DatabaseField m_pkField; 36 protected DatabaseField m_fkField; 37 38 public static final String DEFAULT_NAME = ""; 39 public static final String DEFAULT_COLUMN_DEFINITION = ""; 40 public static final String DEFAULT_REFERENCED_COLUMN_NAME = ""; 41 42 45 public MetadataPrimaryKeyJoinColumn(String sourceTableName, String targetTableName) { 46 m_pkField = new DatabaseField(); 47 m_pkField.setName(DEFAULT_REFERENCED_COLUMN_NAME); 48 m_pkField.setTableName(sourceTableName); 49 50 m_fkField = new DatabaseField(); 51 m_fkField.setName(DEFAULT_NAME); 52 m_fkField.setTableName(targetTableName); 53 m_fkField.setColumnDefinition(DEFAULT_COLUMN_DEFINITION); 54 } 55 56 60 public MetadataPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn, String sourceTableName, String targetTableName) { 61 this(sourceTableName, targetTableName); 62 63 if (primaryKeyJoinColumn != null) { 64 m_pkField.setName(primaryKeyJoinColumn.referencedColumnName()); 66 67 m_fkField.setName(primaryKeyJoinColumn.name()); 69 m_fkField.setColumnDefinition(primaryKeyJoinColumn.columnDefinition()); 70 } 71 } 72 73 76 public DatabaseField getForeignKeyField() { 77 return m_fkField; 78 } 79 80 83 public DatabaseField getPrimaryKeyField() { 84 return m_pkField; 85 } 86 87 90 public boolean isForeignKeyFieldNotSpecified() { 91 return m_fkField.getName().equals(""); 92 } 93 94 97 public boolean isPrimaryKeyFieldNotSpecified() { 98 return m_pkField.getName().equals(""); 99 } 100 101 104 public boolean loadedFromXML() { 105 return false; 106 } 107 } 108 | Popular Tags |