/** * INTERNAL: * Return if this descriptor has children that define additional tables and needs to read them. * This case requires a special read, because the query cannot be done through a single SQL call with normal joins. */ public boolean requiresMultipleTableSubclassRead() { return hasMultipleTableChild() && shouldReadSubclasses(); }
/** * INTERNAL: * Return if this descriptor has children that define additional tables and needs to read them. * This case requires a special read, because the query cannot be done through a single SQL call with normal joins. */ public boolean requiresMultipleTableSubclassRead() { return hasMultipleTableChild() && shouldReadSubclasses(); }
/** * INTERNAL: * Return if this descriptor has children that define additional tables and needs to read them. * This case requires a special read, because the query cannot be done through a single SQL call with normal joins. */ public boolean requiresMultipleTableSubclassRead() { return hasMultipleTableChild() && shouldReadSubclasses(); }
/** * Return whether the reference objects must be deleted * one by one, as opposed to with a single DELETE statement. */ protected boolean mustDeleteReferenceObjectsOneByOne() { ClassDescriptor referenceDescriptor = this.getReferenceDescriptor(); return referenceDescriptor.hasDependencyOnParts() || referenceDescriptor.usesOptimisticLocking() || (referenceDescriptor.hasInheritance() && referenceDescriptor.getInheritancePolicy().shouldReadSubclasses()) || referenceDescriptor.hasMultipleTables(); }
/** * Return whether the reference objects must be deleted * one by one, as opposed to with a single DELETE statement. */ protected boolean mustDeleteReferenceObjectsOneByOne() { ClassDescriptor referenceDescriptor = this.getReferenceDescriptor(); return referenceDescriptor.hasDependencyOnParts() || referenceDescriptor.usesOptimisticLocking() || (referenceDescriptor.hasInheritance() && referenceDescriptor.getInheritancePolicy().shouldReadSubclasses()) || referenceDescriptor.hasMultipleTables() || containerPolicy.propagatesEventsToCollection(); }
/** * INTERNAL: * Post initialize the child descriptors */ protected void addClassIndicatorTypeToParent(Object indicator) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().isChildDescriptor()) { if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { parentDescriptor.getInheritancePolicy().getAllChildClassIndicators().addElement(indicator); } parentDescriptor.getInheritancePolicy().addClassIndicatorTypeToParent(indicator); } }
/** * INTERNAL: * Post initialize the child descriptors */ protected void addClassIndicatorTypeToParent(Object indicator) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().isChildDescriptor()) { if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { parentDescriptor.getInheritancePolicy().getAllChildClassIndicators().add(indicator); } parentDescriptor.getInheritancePolicy().addClassIndicatorTypeToParent(indicator); } }
/** * INTERNAL: * Post initialize the child descriptors */ protected void addClassIndicatorTypeToParent(Object indicator) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().isChildDescriptor()) { if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { parentDescriptor.getInheritancePolicy().getAllChildClassIndicators().add(indicator); } parentDescriptor.getInheritancePolicy().addClassIndicatorTypeToParent(indicator); } }
/** * INTERNAL: * indicates whether additional expressions for multitable inheritance should be used and are available */ public boolean isUsingOuterJoinForMultitableInheritance() { return shouldUseOuterJoinForMultitableInheritance() && getDescriptor() != null && getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().hasMultipleTableChild() && getDescriptor().getInheritancePolicy().shouldReadSubclasses(); }
/** * INTERNAL: * indicates whether additional expressions for multitable inheritance should be used and are available */ public boolean isUsingOuterJoinForMultitableInheritance() { return shouldUseOuterJoinForMultitableInheritance() && getDescriptor() != null && getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().hasMultipleTableChild() && getDescriptor().getInheritancePolicy().shouldReadSubclasses(); }
/** * INTERNAL: * indicates whether additional expressions for multitable inheritance should be used and are available */ public boolean isUsingOuterJoinForMultitableInheritance() { return shouldUseOuterJoinForMultitableInheritance() && getDescriptor() != null && getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().hasMultipleTableChild() && getDescriptor().getInheritancePolicy().shouldReadSubclasses(); }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Recursively adds fields to all the parents */ protected void addFieldsToParent(Vector fields) { if (isChildDescriptor()) { if (getParentDescriptor().isInvalid()) { return; } ClassDescriptor parentDescriptor = getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { Helper.addAllUniqueToVector(parentDescriptor.getAllFields(), fields); } parentDescriptor.getInheritancePolicy().addFieldsToParent(fields); } }
/** * INTERNAL: * Recursively adds fields to all the parents */ protected void addFieldsToParent(Vector fields) { if (isChildDescriptor()) { if (getParentDescriptor().isInvalid()) { return; } ClassDescriptor parentDescriptor = getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { Helper.addAllUniqueToVector(parentDescriptor.getAllFields(), fields); } parentDescriptor.getInheritancePolicy().addFieldsToParent(fields); } }
/** * INTERNAL: * Recursively adds fields to all the parents */ protected void addFieldsToParent(Vector fields) { if (isChildDescriptor()) { if (getParentDescriptor().isInvalid()) { return; } ClassDescriptor parentDescriptor = getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { Helper.addAllUniqueToVector(parentDescriptor.getAllFields(), fields); } parentDescriptor.getInheritancePolicy().addFieldsToParent(fields); } }
/** * INTERNAL: * Ensure the container policy is post initialized */ @Override public void postInitialize(AbstractSession session) { super.postInitialize(session); this.containerPolicy.postInitialize(session); if (this.referenceDescriptor != null && this.mustDeleteReferenceObjectsOneByOne == null) { this.mustDeleteReferenceObjectsOneByOne = this.referenceDescriptor.hasDependencyOnParts() || this.referenceDescriptor.usesOptimisticLocking() || (this.referenceDescriptor.hasInheritance() && this.referenceDescriptor.getInheritancePolicy().shouldReadSubclasses()) || this.referenceDescriptor.hasMultipleTables() || this.containerPolicy.propagatesEventsToCollection() || this.referenceDescriptor.hasRelationshipsExceptBackpointer(descriptor); } else if (this.mustDeleteReferenceObjectsOneByOne == null) { this.mustDeleteReferenceObjectsOneByOne = false; } }
/** * INTERNAL: * Ensure the container policy is post initialized */ @Override public void postInitialize(AbstractSession session) { super.postInitialize(session); this.containerPolicy.postInitialize(session); if (this.referenceDescriptor != null && this.mustDeleteReferenceObjectsOneByOne == null) { this.mustDeleteReferenceObjectsOneByOne = this.referenceDescriptor.hasDependencyOnParts() || this.referenceDescriptor.usesOptimisticLocking() || (this.referenceDescriptor.hasInheritance() && this.referenceDescriptor.getInheritancePolicy().shouldReadSubclasses()) || this.referenceDescriptor.hasMultipleTables() || this.containerPolicy.propagatesEventsToCollection() || this.referenceDescriptor.hasRelationshipsExceptBackpointer(descriptor); } else if (this.mustDeleteReferenceObjectsOneByOne == null) { this.mustDeleteReferenceObjectsOneByOne = false; } }
/** * INTERNAL: * Validate that the descriptor was defined correctly. * This allows for checks to be done that require the descriptor initialization to be completed. */ protected void selfValidationAfterInitialization(AbstractSession session) throws DescriptorException { // This has to be done after, because read subclasses must be initialized. if ( (hasInheritance() && (getInheritancePolicy().shouldReadSubclasses() || isAbstract())) || hasTablePerClassPolicy() && isAbstract() ) { // Avoid building a new instance if the inheritance class is abstract. // There is an empty statement here, and this was done if anything for the // readability sake of the statement logic. } else if (session.getIntegrityChecker().shouldCheckInstantiationPolicy()) { getInstantiationPolicy().buildNewInstance(); } if (hasReturningPolicy()) { getReturningPolicy().validationAfterDescriptorInitialization(session); } getObjectBuilder().validate(session); }