/** * Do any required validation for this node. Throw an exception if it's incorrect. */ @Override public void validateNode() { if ((getQueryKeyOrNull() == null) && (getMapping() == null)) { throw QueryException.invalidQueryKeyInExpression(getName()); } if (!getMapping().isCollectionMapping()) { throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } ContainerPolicy cp = getMapping().getContainerPolicy(); if ((cp == null) || !cp.isMapPolicy()) { throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ @Override public void validateNode() { if ((getQueryKeyOrNull() == null) && (getMapping() == null)) { throw QueryException.invalidQueryKeyInExpression(getName()); } if (!getMapping().isCollectionMapping()) { throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } ContainerPolicy cp = getMapping().getContainerPolicy(); if ((cp == null) || !cp.isMapPolicy()) { throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ public void validateNode() { if ((getQueryKeyOrNull() == null) && (getMapping() == null)) { throw QueryException.invalidQueryKeyInExpression(getName()); } if (!getMapping().isCollectionMapping()){ throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } ContainerPolicy cp = getMapping().getContainerPolicy(); if ((cp == null) || !(cp.isMapPolicy() || cp.isDirectMapPolicy())){ throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } }
@Override public ClassDescriptor getDescriptor() { if (isAttribute()) { return null; } if (descriptor == null) { // Look first for query keys, then mappings. Ultimately we should have query keys // for everything and can dispense with the mapping part. ForeignReferenceQueryKey queryKey = (ForeignReferenceQueryKey)getQueryKeyOrNull(); if (queryKey != null) { descriptor = getSession().getDescriptor(queryKey.getReferenceClass()); return descriptor; } if (getMapping() == null) { throw QueryException.invalidQueryKeyInExpression(this); } // We assume this is either a foreign reference or an aggregate mapping descriptor = getMapping().getContainerPolicy().getDescriptorForMapKey(); if (getMapping().isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(getMapping(), descriptor); } } return descriptor; }
public ClassDescriptor getDescriptor() { if (isAttribute()) { return null; } if (descriptor == null) { // Look first for query keys, then mappings. Ultimately we should have query keys // for everything and can dispense with the mapping part. ForeignReferenceQueryKey queryKey = (ForeignReferenceQueryKey)getQueryKeyOrNull(); if (queryKey != null) { descriptor = getSession().getDescriptor(queryKey.getReferenceClass()); return descriptor; } if (getMapping() == null) { throw QueryException.invalidQueryKeyInExpression(this); } // We assume this is either a foreign reference or an aggregate mapping descriptor = getMapping().getContainerPolicy().getDescriptorForMapKey(); if (getMapping().isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(getMapping(), descriptor); } } return descriptor; }
@Override public ClassDescriptor getDescriptor() { if (isAttribute()) { return null; } if (descriptor == null) { // Look first for query keys, then mappings. Ultimately we should have query keys // for everything and can dispense with the mapping part. ForeignReferenceQueryKey queryKey = (ForeignReferenceQueryKey)getQueryKeyOrNull(); if (queryKey != null) { descriptor = getSession().getDescriptor(queryKey.getReferenceClass()); return descriptor; } if (getMapping() == null) { throw QueryException.invalidQueryKeyInExpression(this); } // We assume this is either a foreign reference or an aggregate mapping descriptor = getMapping().getContainerPolicy().getDescriptorForMapKey(); if (getMapping().isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(getMapping(), descriptor); } } return descriptor; }