/** * INTERNAL: * Selection criteria is created with source foreign keys and target keys. * This criteria is then used to read target records from the table. * * CR#3922 - This method is almost the same as buildSelectionCriteria() the difference * is that getSelectionCriteria() is called */ protected void initializeSelectionCriteria(AbstractSession session) { if (this.getSourceForeignKeysToTargetKeys().isEmpty()) { throw DescriptorException.noForeignKeysAreSpecified(this); } Expression criteria; Expression builder = new ExpressionBuilder(); Iterator keyIterator = getSourceForeignKeysToTargetKeys().keySet().iterator(); while (keyIterator.hasNext()) { DatabaseField foreignKey = (DatabaseField)keyIterator.next(); DatabaseField targetKey = getSourceForeignKeysToTargetKeys().get(foreignKey); Expression expression = builder.getField(targetKey).equal(builder.getParameter(foreignKey)); criteria = expression.and(getSelectionCriteria()); setSelectionCriteria(criteria); } }
/** * INTERNAL: * Selection criteria is created with source foreign keys and target keys. * This criteria is then used to read target records from the table. * * CR#3922 - This method is almost the same as buildSelectionCriteria() the difference * is that getSelectionCriteria() is called */ protected void initializeSelectionCriteria(AbstractSession session) { if (this.getSourceForeignKeysToTargetKeys().isEmpty()) { throw DescriptorException.noForeignKeysAreSpecified(this); } Expression criteria; Expression builder = new ExpressionBuilder(); Iterator keyIterator = getSourceForeignKeysToTargetKeys().keySet().iterator(); while (keyIterator.hasNext()) { DatabaseField foreignKey = (DatabaseField)keyIterator.next(); DatabaseField targetKey = getSourceForeignKeysToTargetKeys().get(foreignKey); Expression expression = builder.getField(targetKey).equal(builder.getParameter(foreignKey)); criteria = expression.and(getSelectionCriteria()); setSelectionCriteria(criteria); } }
/** * Initialize the delete all query. * This query is used to delete the collection of objects from the * database. */ protected void initializeDeleteAllQuery() { ((DeleteAllQuery)this.getDeleteAllQuery()).setReferenceClass(this.getReferenceClass()); if (!this.hasCustomDeleteAllQuery()) { // the selection criteria are re-used by the delete all query this.getDeleteAllQuery().setSelectionCriteria(this.getSelectionCriteria()); } }
/** * Initialize the delete all query. * This query is used to delete the collection of objects from the * database. */ protected void initializeDeleteAllQuery() { ((DeleteAllQuery)this.getDeleteAllQuery()).setReferenceClass(this.getReferenceClass()); if (!this.hasCustomDeleteAllQuery()) { // the selection criteria are re-used by the delete all query this.getDeleteAllQuery().setSelectionCriteria(this.getSelectionCriteria()); } }
/** * Initialize the delete all query. * This query is used to delete the collection of objects from the * database. **/ protected void initializeDeleteAllQuery() { ((DeleteAllQuery)this.getDeleteAllQuery()).setReferenceClass(this.getReferenceClass()); if (!this.hasCustomDeleteAllQuery()) { // the selection criteria are re-used by the delete all query this.getDeleteAllQuery().setSelectionCriteria(this.getSelectionCriteria()); } }