/** * Find and return the exported property matching to this property. */ ExportedProperty findMatch(boolean embedded, BeanProperty prop, String matchColumn, TableJoin tableJoin) { String searchTable = tableJoin.getTable(); for (TableJoinColumn column : tableJoin.columns()) { String matchTo = column.getLocalDbColumn(); if (matchColumn.equalsIgnoreCase(matchTo)) { String foreignCol = column.getForeignDbColumn(); return new ExportedProperty(embedded, foreignCol, prop); } } String msg = "Error with the Join on [" + getFullBeanName() + "]. Could not find the matching foreign key for [" + matchColumn + "] in table[" + searchTable + "]?" + " Perhaps using a @JoinColumn with the name/referencedColumnName attributes swapped?"; throw new PersistenceException(msg); } }
private ImportedIdSimple createImportedScalar(BeanPropertyAssoc<?> owner, TableJoinColumn col, BeanProperty[] props, BeanProperty[] others) { String matchColumn = col.getForeignDbColumn(); String localColumn = col.getLocalDbColumn(); String localSqlFormula = col.getLocalSqlFormula(); boolean insertable = col.isInsertable(); boolean updateable = col.isUpdateable(); for (int j = 0; j < props.length; j++) { if (props[j].getDbColumn().equalsIgnoreCase(matchColumn)) { return new ImportedIdSimple(owner, localColumn, localSqlFormula, props[j], j, insertable, updateable); } } for (int j = 0; j < others.length; j++) { if (others[j].getDbColumn().equalsIgnoreCase(matchColumn)) { return new ImportedIdSimple(owner, localColumn, localSqlFormula, others[j], j + props.length, insertable, updateable); } } String msg = "Error with the Join on [" + getFullBeanName() + "]. Could not find the local match for [" + matchColumn + "] "//in table["+searchTable+"]?" + " Perhaps an error in a @JoinColumn"; throw new PersistenceException(msg); }
/** * Find and return the exported property matching to this property. */ ExportedProperty findMatch(boolean embedded, BeanProperty prop, String matchColumn, TableJoin tableJoin) { String searchTable = tableJoin.getTable(); for (TableJoinColumn column : tableJoin.columns()) { String matchTo = column.getLocalDbColumn(); if (matchColumn.equalsIgnoreCase(matchTo)) { String foreignCol = column.getForeignDbColumn(); return new ExportedProperty(embedded, foreignCol, prop); } } String msg = "Error with the Join on [" + getFullBeanName() + "]. Could not find the matching foreign key for [" + matchColumn + "] in table[" + searchTable + "]?" + " Perhaps using a @JoinColumn with the name/referencedColumnName attributes swapped?"; throw new PersistenceException(msg); } }
private ImportedIdSimple createImportedScalar(BeanPropertyAssoc<?> owner, TableJoinColumn col, BeanProperty[] props, BeanProperty[] others) { String matchColumn = col.getForeignDbColumn(); String localColumn = col.getLocalDbColumn(); String localSqlFormula = col.getLocalSqlFormula(); boolean insertable = col.isInsertable(); boolean updateable = col.isUpdateable(); for (int j = 0; j < props.length; j++) { if (props[j].getDbColumn().equalsIgnoreCase(matchColumn)) { return new ImportedIdSimple(owner, localColumn, localSqlFormula, props[j], j, insertable, updateable); } } for (int j = 0; j < others.length; j++) { if (others[j].getDbColumn().equalsIgnoreCase(matchColumn)) { return new ImportedIdSimple(owner, localColumn, localSqlFormula, others[j], j + props.length, insertable, updateable); } } String msg = "Error with the Join on [" + getFullBeanName() + "]. Could not find the local match for [" + matchColumn + "] "//in table["+searchTable+"]?" + " Perhaps an error in a @JoinColumn"; throw new PersistenceException(msg); }