public IntersectionRow buildManyDeleteChildren(EntityBean parentBean, List<Object> excludeDetailIds) { IntersectionRow row = new IntersectionRow(tableJoin.getTable(), targetDescriptor); if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) { row.setExcludeIds(excludeDetailIds, getTargetDescriptor()); } buildExport(row, parentBean); return row; }
sb.append(",m2m:").append(m2mIncludeJoin.getTable());
private boolean isSaveIntersection() { if (!many.isManyToMany()) { return true; } return transaction.isSaveAssocManyIntersection(many.getIntersectionTableJoin().getTable(), many.getBeanDescriptor().rootName()); }
/** * 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); } }
BeanPropertyAssocManySqlHelp(BeanPropertyAssocMany<T> many, ExportedProperty[] exportedProperties) { this.many = many; this.exportedProperties = exportedProperties; this.hasJoinTable = many.hasJoinTable(); this.descriptor = many.getBeanDescriptor(); this.exportedPropertyBindProto = deriveExportedPropertyBindProto(); String delStmt; if (hasJoinTable) { delStmt = "delete from " + many.inverseJoin.getTable() + " where "; } else { delStmt = "delete from " + many.targetTable() + " where "; } deleteByParentIdSql = delStmt + deriveWhereParentIdSql(false, ""); deleteByParentIdInSql = delStmt + deriveWhereParentIdSql(true, ""); if (many.isElementCollection()) { elementCollectionInsertSql = elementCollectionInsert(); } else { elementCollectionInsertSql = null; } }
String msg = "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]"; logger.error(msg); return null;
/** * Create this property. */ public BeanPropertyAssocMany(BeanDescriptor<?> descriptor, DeployBeanPropertyAssocMany<T> deploy) { super(descriptor, deploy); this.unidirectional = deploy.isUnidirectional(); this.o2mJoinTable = deploy.isO2mJoinTable(); this.hasOrderColumn = deploy.hasOrderColumn(); this.manyToMany = deploy.isManyToMany(); this.elementCollection = deploy.isElementCollection(); this.elementDescriptor = deploy.getElementDescriptor(); this.manyType = deploy.getManyType(); this.mapKey = deploy.getMapKey(); this.fetchOrderBy = deploy.getFetchOrderBy(); this.intersectionJoin = deploy.createIntersectionTableJoin(); if (intersectionJoin != null) { this.intersectionPublishTable = intersectionJoin.getTable(); this.intersectionDraftTable = deploy.getIntersectionDraftTable(); } else { this.intersectionPublishTable = null; this.intersectionDraftTable = null; } this.inverseJoin = deploy.createInverseTableJoin(); this.modifyListenMode = deploy.getModifyListenMode(); this.jsonHelp = new BeanPropertyAssocManyJsonHelp(this); }
private MTable createTable() { BeanDescriptor<?> localDesc = manyProp.getBeanDescriptor(); BeanDescriptor<?> targetDesc = manyProp.getTargetDescriptor(); String tableName = intersectionTableJoin.getTable(); MTable table = new MTable(tableName); if (!manyProp.isExcludedFromHistory()) { if (localDesc.isHistorySupport()) { table.setWithHistory(true); } } table.setPkName(ctx.primaryKeyName(tableName)); TableJoinColumn[] columns = intersectionTableJoin.columns(); for (TableJoinColumn column : columns) { addColumn(table, localDesc, column.getForeignDbColumn(), column.getLocalDbColumn()); } TableJoinColumn[] otherColumns = tableJoin.columns(); for (TableJoinColumn otherColumn : otherColumns) { addColumn(table, targetDesc, otherColumn.getLocalDbColumn(), otherColumn.getForeignDbColumn()); } return table; }
initContext.addHistoryIntersection(intersectionTableJoin.getTable());
public IntersectionRow buildManyDeleteChildren(EntityBean parentBean, List<Object> excludeDetailIds) { IntersectionRow row = new IntersectionRow(tableJoin.getTable(), targetDescriptor); if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) { row.setExcludeIds(excludeDetailIds, getTargetDescriptor()); } buildExport(row, parentBean); return row; }
sb.append(",m2m:").append(m2mIncludeJoin.getTable());
private boolean isSaveIntersection() { if (!many.isManyToMany()) { return true; } return transaction.isSaveAssocManyIntersection(many.getIntersectionTableJoin().getTable(), many.getBeanDescriptor().rootName()); }
/** * 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); } }
if (primaryKeyJoin != null && !table.isPartitioned()) { TableJoinColumn[] columns = primaryKeyJoin.columns(); col.setReferences(primaryKeyJoin.getTable() + "." + columns[0].getForeignDbColumn()); col.setForeignKeyName(determineForeignKeyConstraintName(col.getName()));
BeanPropertyAssocManySqlHelp(BeanPropertyAssocMany<T> many, ExportedProperty[] exportedProperties) { this.many = many; this.exportedProperties = exportedProperties; this.hasJoinTable = many.hasJoinTable(); this.descriptor = many.getBeanDescriptor(); this.exportedPropertyBindProto = deriveExportedPropertyBindProto(); String delStmt; if (hasJoinTable) { delStmt = "delete from " + many.inverseJoin.getTable() + " where "; } else { delStmt = "delete from " + many.targetTable() + " where "; } deleteByParentIdSql = delStmt + deriveWhereParentIdSql(false, ""); deleteByParentIdInSql = delStmt + deriveWhereParentIdSql(true, ""); if (many.isElementCollection()) { elementCollectionInsertSql = elementCollectionInsert(); } else { elementCollectionInsertSql = null; } }
String msg = "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]"; logger.error(msg); return null;
/** * Create this property. */ public BeanPropertyAssocMany(BeanDescriptor<?> descriptor, DeployBeanPropertyAssocMany<T> deploy) { super(descriptor, deploy); this.unidirectional = deploy.isUnidirectional(); this.o2mJoinTable = deploy.isO2mJoinTable(); this.hasOrderColumn = deploy.hasOrderColumn(); this.manyToMany = deploy.isManyToMany(); this.elementCollection = deploy.isElementCollection(); this.elementDescriptor = deploy.getElementDescriptor(); this.manyType = deploy.getManyType(); this.mapKey = deploy.getMapKey(); this.fetchOrderBy = deploy.getFetchOrderBy(); this.intersectionJoin = deploy.createIntersectionTableJoin(); if (intersectionJoin != null) { this.intersectionPublishTable = intersectionJoin.getTable(); this.intersectionDraftTable = deploy.getIntersectionDraftTable(); } else { this.intersectionPublishTable = null; this.intersectionDraftTable = null; } this.inverseJoin = deploy.createInverseTableJoin(); this.modifyListenMode = deploy.getModifyListenMode(); this.jsonHelp = new BeanPropertyAssocManyJsonHelp(this); }
private MTable createTable() { BeanDescriptor<?> localDesc = manyProp.getBeanDescriptor(); BeanDescriptor<?> targetDesc = manyProp.getTargetDescriptor(); String tableName = intersectionTableJoin.getTable(); MTable table = new MTable(tableName); if (!manyProp.isExcludedFromHistory()) { if (localDesc.isHistorySupport()) { table.setWithHistory(true); } } table.setPkName(ctx.primaryKeyName(tableName)); TableJoinColumn[] columns = intersectionTableJoin.columns(); for (TableJoinColumn column : columns) { addColumn(table, localDesc, column.getForeignDbColumn(), column.getLocalDbColumn()); } TableJoinColumn[] otherColumns = tableJoin.columns(); for (TableJoinColumn otherColumn : otherColumns) { addColumn(table, targetDesc, otherColumn.getLocalDbColumn(), otherColumn.getForeignDbColumn()); } return table; }
initContext.addHistoryIntersection(intersectionTableJoin.getTable());
if (primaryKeyJoin != null && !table.isPartitioned()) { TableJoinColumn[] columns = primaryKeyJoin.columns(); col.setReferences(primaryKeyJoin.getTable() + "." + columns[0].getForeignDbColumn()); col.setForeignKeyName(determineForeignKeyConstraintName(col.getName()));