@Override public Expression getJoinCriteria(ObjectExpression context, Expression base) { Expression selectionCriteria = getSelectionCriteria(); Expression keySelectionCriteria = this.containerPolicy.getKeySelectionCriteria(); if (keySelectionCriteria != null) { selectionCriteria = selectionCriteria.and(keySelectionCriteria); } if (additionalJoinCriteria != null) { selectionCriteria = selectionCriteria.and(additionalJoinCriteria); } return context.getBaseExpression().twist(selectionCriteria, base); }
/** * Initialize the delete all query. * This query is used to delete the collection of objects from the * database. */ protected void initializeDeleteAllQuery() { ((DeleteAllQuery)getDeleteAllQuery()).setReferenceClass(getReferenceClass()); if (!hasCustomDeleteAllQuery()) { // the selection criteria are re-used by the delete all query if (getSelectionCriteria() == null) { getDeleteAllQuery().setSelectionCriteria(buildDefaultSelectionCriteriaAndAddFieldsToQuery()); } else { getDeleteAllQuery().setSelectionCriteria(getSelectionCriteria()); } } }
/** * INTERNAL: Generates the delete all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingDeleteAllProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); DeleteAllQuery deleteAllQuery = new DeleteAllQuery(); deleteAllQuery.setDescriptor(targetDescriptor); deleteAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); deleteAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, deleteAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "D_1M_"); }
/** * INTERNAL: Generates the delete all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingDeleteAllProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); DeleteAllQuery deleteAllQuery = new DeleteAllQuery(); deleteAllQuery.setDescriptor(targetDescriptor); deleteAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); deleteAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, deleteAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "D_1M_"); }
/** * INTERNAL: Generates the delete all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingDeleteAllProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); DeleteAllQuery deleteAllQuery = new DeleteAllQuery(); deleteAllQuery.setDescriptor(targetDescriptor); deleteAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); deleteAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, deleteAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "D_1M_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * Initialize the delete all query. * This query is used to delete the collection of objects from the * database. */ protected void initializeDeleteAllQuery(AbstractSession session) { ((DeleteAllQuery)getDeleteAllQuery()).setReferenceClass(getReferenceClass()); getDeleteAllQuery().setName(getAttributeName()); ((DeleteAllQuery)getDeleteAllQuery()).setIsInMemoryOnly(isCascadeOnDeleteSetOnDatabase()); if (!hasCustomDeleteAllQuery()) { // the selection criteria are re-used by the delete all query if (getSelectionCriteria() == null) { getDeleteAllQuery().setSelectionCriteria(buildDefaultSelectionCriteriaAndAddFieldsToQuery()); } else { getDeleteAllQuery().setSelectionCriteria(getSelectionCriteria()); } } if (!getDeleteAllQuery().hasSessionName()) { getDeleteAllQuery().setSessionName(session.getName()); } if (getDeleteAllQuery().getPartitioningPolicy() == null) { getDeleteAllQuery().setPartitioningPolicy(getPartitioningPolicy()); } }
/** * Initialize the delete all query. * This query is used to delete the collection of objects from the * database. */ protected void initializeDeleteAllQuery(AbstractSession session) { ((DeleteAllQuery)getDeleteAllQuery()).setReferenceClass(getReferenceClass()); getDeleteAllQuery().setName(getAttributeName()); ((DeleteAllQuery)getDeleteAllQuery()).setIsInMemoryOnly(isCascadeOnDeleteSetOnDatabase()); if (!hasCustomDeleteAllQuery()) { // the selection criteria are re-used by the delete all query if (getSelectionCriteria() == null) { getDeleteAllQuery().setSelectionCriteria(buildDefaultSelectionCriteriaAndAddFieldsToQuery()); } else { getDeleteAllQuery().setSelectionCriteria(getSelectionCriteria()); } } if (!getDeleteAllQuery().hasSessionName()) { getDeleteAllQuery().setSessionName(session.getName()); } if (getDeleteAllQuery().getPartitioningPolicy() == null) { getDeleteAllQuery().setPartitioningPolicy(getPartitioningPolicy()); } }