private DereferenceType resolveAsNakedPropertyRef() { FromElement fromElement = locateSingleFromElement(); if (fromElement == null) { return DereferenceType.UNKNOWN; } Queryable persister = fromElement.getQueryable(); if (persister == null) { return DereferenceType.UNKNOWN; } Type propertyType = getNakedPropertyType(fromElement); if (propertyType == null) { // assume this ident's text does *not* refer to a property on the given persister return DereferenceType.UNKNOWN; } if ((propertyType.isComponentType() || propertyType.isAssociationType() )) { return DereferenceType.COMPONENT_REF; } setFromElement(fromElement); String property = getText(); String[] columns = getWalker().isSelectStatement() ? persister.toColumns(fromElement.getTableAlias(), property) : persister.toColumns(property); String text = String.join(", ", columns); setText(columns.length == 1 ? text : "(" + text + ")"); setType(SqlTokenTypes.SQL_TOKEN); // these pieces are needed for usage in select clause super.setDataType(propertyType); nakedPropertyRef = true; return DereferenceType.PROPERTY_REF; }
private boolean resolveAsNakedComponentPropertyRefLHS(DotNode parent) { FromElement fromElement = locateSingleFromElement(); if (fromElement == null) { return false; } Type componentType = getNakedPropertyType(fromElement); if ( componentType == null ) { throw new QueryException( "Unable to resolve path [" + parent.getPath() + "], unexpected token [" + getOriginalText() + "]" ); } if (!componentType.isComponentType()) { throw new QueryException("Property '" + getOriginalText() + "' is not a component. Use an alias to reference associations or collections."); } Type propertyType; String propertyPath = getText() + "." + getNextSibling().getText(); try { // check to see if our "propPath" actually // represents a property on the persister propertyType = fromElement.getPropertyType(getText(), propertyPath); } catch (Throwable t) { // assume we do *not* refer to a property on the given persister return false; } setFromElement(fromElement); parent.setPropertyPath(propertyPath); parent.setDataType(propertyType); return true; }
private int resolveAsNakedPropertyRef() { FromElement fromElement = locateSingleFromElement(); if (fromElement == null) { return UNKNOWN; } Queryable persister = fromElement.getQueryable(); if (persister == null) { return UNKNOWN; } Type propertyType = getNakedPropertyType(fromElement); if (propertyType == null) { // assume this ident's text does *not* refer to a property on the given persister return UNKNOWN; } if ((propertyType.isComponentType() || propertyType.isAssociationType() )) { return COMPONENT_REF; } setFromElement(fromElement); String property = getText(); String[] columns = getWalker().isSelectStatement() ? persister.toColumns(fromElement.getTableAlias(), property) : persister.toColumns(property); String text = StringHelper.join(", ", columns); setText(columns.length == 1 ? text : "(" + text + ")"); setType(SqlTokenTypes.SQL_TOKEN); // these pieces are needed for usage in select clause super.setDataType(propertyType); nakedPropertyRef = true; return PROPERTY_REF; }
private boolean resolveAsNakedComponentPropertyRefLHS(DotNode parent) { FromElement fromElement = locateSingleFromElement(); if (fromElement == null) { return false; } Type componentType = getNakedPropertyType(fromElement); if ( componentType == null ) { throw new QueryException( "Unable to resolve path [" + parent.getPath() + "], unexpected token [" + getOriginalText() + "]" ); } if (!componentType.isComponentType()) { throw new QueryException("Property '" + getOriginalText() + "' is not a component. Use an alias to reference associations or collections."); } Type propertyType = null; // used to set the type of the parent dot node String propertyPath = getText() + "." + getNextSibling().getText(); try { // check to see if our "propPath" actually // represents a property on the persister propertyType = fromElement.getPropertyType(getText(), propertyPath); } catch (Throwable t) { // assume we do *not* refer to a property on the given persister return false; } setFromElement(fromElement); parent.setPropertyPath(propertyPath); parent.setDataType(propertyType); return true; }
private boolean resolveAsNakedComponentPropertyRefLHS(DotNode parent) { FromElement fromElement = locateSingleFromElement(); if (fromElement == null) { return false; } Type componentType = getNakedPropertyType(fromElement); if ( componentType == null ) { throw new QueryException( "Unable to resolve path [" + parent.getPath() + "], unexpected token [" + getOriginalText() + "]" ); } if (!componentType.isComponentType()) { throw new QueryException("Property '" + getOriginalText() + "' is not a component. Use an alias to reference associations or collections."); } Type propertyType = null; // used to set the type of the parent dot node String propertyPath = getText() + "." + getNextSibling().getText(); try { // check to see if our "propPath" actually // represents a property on the persister propertyType = fromElement.getPropertyType(getText(), propertyPath); } catch (Throwable t) { // assume we do *not* refer to a property on the given persister return false; } setFromElement(fromElement); parent.setPropertyPath(propertyPath); parent.setDataType(propertyType); return true; }
private int resolveAsNakedPropertyRef() { FromElement fromElement = locateSingleFromElement(); if (fromElement == null) { return UNKNOWN; } Queryable persister = fromElement.getQueryable(); if (persister == null) { return UNKNOWN; } Type propertyType = getNakedPropertyType(fromElement); if (propertyType == null) { // assume this ident's text does *not* refer to a property on the given persister return UNKNOWN; } if ((propertyType.isComponentType() || propertyType.isAssociationType() )) { return COMPONENT_REF; } setFromElement(fromElement); String property = getText(); String[] columns = getWalker().isSelectStatement() ? persister.toColumns(fromElement.getTableAlias(), property) : persister.toColumns(property); String text = StringHelper.join(", ", columns); setText(columns.length == 1 ? text : "(" + text + ")"); setType(SqlTokenTypes.SQL_TOKEN); // these pieces are needed for usage in select clause super.setDataType(propertyType); nakedPropertyRef = true; return PROPERTY_REF; }