[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4541) collection_valued_input_parameter not working in IN statement

Farrukh Najmi (JIRA) noreply at atlassian.com
Mon Nov 2 11:24:53 EST 2009


collection_valued_input_parameter not working in IN statement
-------------------------------------------------------------

                 Key: HHH-4541
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4541
             Project: Hibernate Core
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 3.5.0.Beta-1
            Reporter: Farrukh Najmi



3.5.0-Beta1 of hibernate-entitymanager supports JPA 2.0.
According to section 4.6.9 of the JPA 2.0 spec an IN statement can have a collection_valued_input_parameter:

"
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

"

When I try the following query:

SELECT DISTINCT Object(p) FROM org.freebxml.omar.jaxb.bindings.rim._4_0.PersonType p, org.freebxml.omar.jaxb.bindings.rim._4_0.AssociationType a WHERE a.sourceObject = :sourceObjectId AND p.id = a.targetObject AND a.type IN  :typexxx


with a List<String> value for collection_valued_input_parameter :typexxx I get the following unexpected error:

Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 226 [SELECT DISTINCT Object(p) FROM org.freebxml.omar.jaxb.bindings.rim._4_0.PersonType p, org.freebxml.omar.jaxb.bindings.rim._4_0.AssociationType a WHERE a.sourceObject = :sourceObjectId AND p.id = a.targetObject AND a.type IN  :typexxx ]
        at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
        at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
        at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
        at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284)
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
        at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
        at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
        at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1585)
        at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:121)


-- 
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