/** INTERNAL: Return if the expression is for a direct mapped attribute. */ public boolean isAttribute() { if (isAttributeExpression == null) { if (getSession() == null) { // We can't tell, so say no. return false; } QueryKey queryKey = getQueryKeyOrNull(); if (queryKey != null) { isAttributeExpression = Boolean.valueOf(queryKey.isDirectQueryKey()); } else { DatabaseMapping mapping = getMapping(); if (mapping != null) { if (mapping.isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping( mapping, mapping.getDescriptor()); } else { isAttributeExpression = Boolean.valueOf(mapping.isDirectToFieldMapping()); } } else { isAttributeExpression = Boolean.FALSE; } } } return isAttributeExpression.booleanValue(); }