[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5680) IN expression does not conform to JPA spec.

Azuo Lee (JIRA) noreply at atlassian.com
Wed Oct 20 00:07:47 EDT 2010


IN expression does not conform to JPA spec.
-------------------------------------------

                 Key: HHH-5680
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5680
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.6.0
            Reporter: Azuo Lee


According to JPA 2.0 spec 4.6.9, the sytax for an IN expression should be:

in_expression ::=
    {state_field_path_expression | type_discriminator} [NOT] IN
        { ( in_item {, in_item}* ) | (subquery) | collection_valued_input_parameter }
in_item ::= literal | single_valued_input_parameter

Note that parentheses are required only if a subquery, or one or more listerals or single_valued_input_parameters is used, but should be absent if a collection_valued_input_parameter is used.

For example, with the following query parameters:
p1 : String "01";
p2 : String "02";
p3 : List containing 2 Strings "01" and "02";

the following IN expressions should all be legal, per JPA spec:
IN ("01", "02")
IN (:p1, :p2)
IN (:p1)
IN :p3

but the following expressions are ILLEGAL:
IN :p1
IN (:p3)

Current Hibernate implementation requires parentheses as mandatory in an IN expression, this is not conform to the JPA spec.

Using of parentheses in an IN expression provides a strict syntax to distinguish between a single_valued_input_parameter and a collection_valued_input_parameter, which is more reliable than "guessing" the semantics of the parameter by examining its Java type.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list