/** * INTERNAL * Defines the type of the parameter with the specified name. */ public void defineParameterType(String parameterName, Object parameterType, int line, int column) { if (parameterTypes.containsKey(parameterName)) { // existing entry Object oldType = parameterTypes.get(parameterName); if (typeHelper.isAssignableFrom(oldType, parameterType)) { // OK } else if (typeHelper.isAssignableFrom(parameterType, oldType)) { // new parameter type is more general parameterTypes.put(parameterName, parameterType); } else { // error case old usage and new usage do not match type throw JPQLException.invalidMultipleUseOfSameParameter( getQueryInfo(), line, column, parameterName, typeHelper.getTypeName(oldType), typeHelper.getTypeName(parameterType)); } } else { // new entry parameterTypes.put(parameterName, parameterType); } }
/** * INTERNAL * Defines the type of the parameter with the specified name. */ public void defineParameterType(String parameterName, Object parameterType, int line, int column) { if (parameterTypes.containsKey(parameterName)) { // existing entry Object oldType = parameterTypes.get(parameterName); if (typeHelper.isAssignableFrom(oldType, parameterType)) { // OK } else if (typeHelper.isAssignableFrom(parameterType, oldType)) { // new parameter type is more general parameterTypes.put(parameterName, parameterType); } else { // error case old usage and new usage do not match type throw JPQLException.invalidMultipleUseOfSameParameter( getQueryInfo(), line, column, parameterName, typeHelper.getTypeName(oldType), typeHelper.getTypeName(parameterType)); } } else { // new entry parameterTypes.put(parameterName, parameterType); } }
/** * INTERNAL * Defines the type of the parameter with the specified name. */ public void defineParameterType(String parameterName, Object parameterType, int line, int column) { if (parameterTypes.containsKey(parameterName)) { // existing entry Object oldType = parameterTypes.get(parameterName); if (typeHelper.isAssignableFrom(oldType, parameterType)) { // OK } else if (typeHelper.isAssignableFrom(parameterType, oldType)) { // new parameter type is more general parameterTypes.put(parameterName, parameterType); } else { // error case old usage and new usage do not match type throw JPQLException.invalidMultipleUseOfSameParameter( getQueryInfo(), line, column, parameterName, typeHelper.getTypeName(oldType), typeHelper.getTypeName(parameterType)); } } else { // new entry parameterTypes.put(parameterName, parameterType); } }
/** * INTERNAL * Validate node and calculates its type. */ public void validate(ParseTreeContext context) { super.validate(context); TypeHelper typeHelper = context.getTypeHelper(); Object leftType = left.getType(); Object rightType = right.getType(); if (typeHelper.isEnumType(leftType) && !typeHelper.isEnumType(rightType)) { throw JPQLException.invalidEnumEqualExpression( context.getQueryInfo(), getLine(), getColumn(), typeHelper.getTypeName(leftType), typeHelper.getTypeName(rightType)); } else if (typeHelper.isEnumType(rightType) && !typeHelper.isEnumType(leftType)) { throw JPQLException.invalidEnumEqualExpression( context.getQueryInfo(), getLine(), getColumn(), typeHelper.getTypeName(rightType), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate node and calculates its type. */ public void validate(ParseTreeContext context) { super.validate(context); TypeHelper typeHelper = context.getTypeHelper(); Object leftType = left.getType(); Object rightType = right.getType(); if (typeHelper.isEnumType(leftType) && !typeHelper.isEnumType(rightType)) { throw JPQLException.invalidEnumEqualExpression( context.getQueryInfo(), getLine(), getColumn(), typeHelper.getTypeName(leftType), typeHelper.getTypeName(rightType)); } else if (typeHelper.isEnumType(rightType) && !typeHelper.isEnumType(leftType)) { throw JPQLException.invalidEnumEqualExpression( context.getQueryInfo(), getLine(), getColumn(), typeHelper.getTypeName(rightType), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate node and calculates its type. */ public void validate(ParseTreeContext context) { super.validate(context); TypeHelper typeHelper = context.getTypeHelper(); Object leftType = left.getType(); Object rightType = right.getType(); if (typeHelper.isEnumType(leftType) && !typeHelper.isEnumType(rightType)) { throw JPQLException.invalidEnumEqualExpression( context.getQueryInfo(), getLine(), getColumn(), typeHelper.getTypeName(leftType), typeHelper.getTypeName(rightType)); } else if (typeHelper.isEnumType(rightType) && !typeHelper.isEnumType(leftType)) { throw JPQLException.invalidEnumEqualExpression( context.getQueryInfo(), getLine(), getColumn(), typeHelper.getTypeName(rightType), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (orderNode == null){ if (orderByItem instanceof Node){ orderNode = (Node)orderByItem; } else { orderNode = context.pathForVariable((String)orderByItem); if (orderNode == null){ throw JPQLException.nonExistantOrderByAlias( context.getQueryInfo(), getLine(), getColumn(), (String)orderByItem); } } } if (orderNode != null) { orderNode.validate(context); Object type = orderNode.getType(); setType(type); if (!typeHelper.isOrderableType(type)) { throw JPQLException.expectedOrderableOrderByItem( context.getQueryInfo(), orderNode.getLine(), orderNode.getColumn(), orderNode.getAsString(), typeHelper.getTypeName(type)); } } }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (orderNode == null){ if (orderByItem instanceof Node){ orderNode = (Node)orderByItem; } else { orderNode = context.pathForVariable((String)orderByItem); if (orderNode == null){ throw JPQLException.nonExistantOrderByAlias( context.getQueryInfo(), getLine(), getColumn(), (String)orderByItem); } } } if (orderNode != null) { orderNode.validate(context); Object type = orderNode.getType(); setType(type); if (!typeHelper.isOrderableType(type)) { throw JPQLException.expectedOrderableOrderByItem( context.getQueryInfo(), orderNode.getLine(), orderNode.getColumn(), orderNode.getAsString(), typeHelper.getTypeName(type)); } } }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (orderNode == null){ if (orderByItem instanceof Node){ orderNode = (Node)orderByItem; } else { orderNode = context.pathForVariable((String)orderByItem); if (orderNode == null){ throw JPQLException.nonExistantOrderByAlias( context.getQueryInfo(), getLine(), getColumn(), (String)orderByItem); } } } if (orderNode != null) { orderNode.validate(context); Object type = orderNode.getType(); setType(type); if (!typeHelper.isOrderableType(type)) { throw JPQLException.expectedOrderableOrderByItem( context.getQueryInfo(), orderNode.getLine(), orderNode.getColumn(), orderNode.getAsString(), typeHelper.getTypeName(type)); } } }
/** * INTERNAL * Checks whether the left hand side of this dot node is navigable. */ private void checkNavigation(Node node, ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); // Checks whether the type of the dot node allows a navigation. Object type = node.getType(); if (!typeHelper.isEntityClass(type) && !typeHelper.isEmbeddable(type) && !typeHelper.isEnumType(type)) { throw JPQLException.invalidNavigation( context.getQueryInfo(), node.getLine(), node.getColumn(), this.getAsString(), node.getAsString(), typeHelper.getTypeName(type)); } // Special check to disallow collection valued relationships if (node.isDotNode()) { Node left = node.getLeft(); AttributeNode right = (AttributeNode)node.getRight(); if (typeHelper.isCollectionValuedRelationship( left.getType(), right.getAttributeName())) { throw JPQLException.invalidCollectionNavigation( context.getQueryInfo(), right.getLine(), right.getColumn(), this.getAsString(), right.getAttributeName()); } } }
/** * INTERNAL * Checks whether the left hand side of this dot node is navigable. */ private void checkNavigation(Node node, ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); // Checks whether the type of the dot node allows a navigation. Object type = node.getType(); if (!typeHelper.isEntityClass(type) && !typeHelper.isEmbeddable(type) && !typeHelper.isEnumType(type)) { throw JPQLException.invalidNavigation( context.getQueryInfo(), node.getLine(), node.getColumn(), this.getAsString(), node.getAsString(), typeHelper.getTypeName(type)); } // Special check to disallow collection valued relationships if (node.isDotNode()) { Node left = node.getLeft(); AttributeNode right = (AttributeNode)node.getRight(); if (typeHelper.isCollectionValuedRelationship( left.getType(), right.getAttributeName())) { throw JPQLException.invalidCollectionNavigation( context.getQueryInfo(), right.getLine(), right.getColumn(), this.getAsString(), right.getAttributeName()); } } }
/** * INTERNAL * Checks whether the left hand side of this dot node is navigable. */ private void checkNavigation(Node node, ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); // Checks whether the type of the dot node allows a navigation. Object type = node.getType(); if (!typeHelper.isEntityClass(type) && !typeHelper.isEmbeddable(type) && !typeHelper.isEnumType(type)) { throw JPQLException.invalidNavigation( context.getQueryInfo(), node.getLine(), node.getColumn(), this.getAsString(), node.getAsString(), typeHelper.getTypeName(type)); } // Special check to disallow collection valued relationships if (node.isDotNode()) { Node left = node.getLeft(); AttributeNode right = (AttributeNode)node.getRight(); if (typeHelper.isCollectionValuedRelationship( left.getType(), right.getAttributeName())) { throw JPQLException.invalidCollectionNavigation( context.getQueryInfo(), right.getLine(), right.getColumn(), this.getAsString(), right.getAttributeName()); } } }
name, typeHelper.getTypeName(left.getType()));
name, typeHelper.getTypeName(left.getType()));
name, typeHelper.getTypeName(left.getType()));