Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-5126

JPA Query with InExpression and Collection_valued_input_parameter Complains About Bad Syntax

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.5.1, 3.6.0
    • Fix Version/s: 3.6.1, 4.0.0.Alpha1
    • Component/s: None
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      JPA 2.0 spec final chapter 4.6.9 In Expressions

      In the spec there are 3 alternatives allowed for the query argument. For the 3rd alternative there are no parenthesis allowed.

      Hibernate seems to expect these illegal parenthesis.

      The error occurs within a named query in an entity class.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              netangel Anthony Ogier added a comment -

              Still not solved for 4.1.8.Final

              Show
              netangel Anthony Ogier added a comment - Still not solved for 4.1.8.Final
              Hide
              steve Steve Ebersole added a comment -

              Well as I asked on the other issue, please attach a test case that reproduces this. The tests I wrote show this working perfectly fine. Even in the HHH-7407 case of double parameter lists.

              Show
              steve Steve Ebersole added a comment - Well as I asked on the other issue, please attach a test case that reproduces this. The tests I wrote show this working perfectly fine. Even in the HHH-7407 case of double parameter lists.
              Hide
              kwutzke Karsten Wutzke added a comment -

              Sorry for being kind of offline so long. I think the difference is that I was using lists of entities for the IN parameters :companies and :docTypes. IIRC only primitive types are allowed - at least by the JPA? Since I'm not 100% sure, can anybody confirm this? (Note I duplicated this comment onto HHH-7407, too.)

              Show
              kwutzke Karsten Wutzke added a comment - Sorry for being kind of offline so long. I think the difference is that I was using lists of entities for the IN parameters :companies and :docTypes. IIRC only primitive types are allowed - at least by the JPA? Since I'm not 100% sure, can anybody confirm this? (Note I duplicated this comment onto HHH-7407 , too.)
              Hide
              viperidae Chris added a comment -

              I'm experiencing this issue in Hibernate 4.2.1 Final

              In out case we've got a IN placeholder as the last part of a sub query.

              Something like:

              SELECT column_one, (select count from XYZ where column IN :parameterList) FROM ABC

              The code in org.hibernate.internal.util.StringHelper.replace(String, String, String, String, boolean, boolean) on line 168 checks to see if the placeholder has both an opening backet in front of AND a closing backet after. If both of these criteria are not satisfied no backets are inserted.

              A similar check to this is done in org.hibernate.internal.AbstractQueryImpl.expandParameterList(String, String, TypedValue, Map) on line 790

              Hibernate doesn't realise the closing bracket after the placeholder belongs to the sub query.

              Show
              viperidae Chris added a comment - I'm experiencing this issue in Hibernate 4.2.1 Final In out case we've got a IN placeholder as the last part of a sub query. Something like: SELECT column_one, (select count from XYZ where column IN :parameterList) FROM ABC The code in org.hibernate.internal.util.StringHelper.replace(String, String, String, String, boolean, boolean) on line 168 checks to see if the placeholder has both an opening backet in front of AND a closing backet after. If both of these criteria are not satisfied no backets are inserted. A similar check to this is done in org.hibernate.internal.AbstractQueryImpl.expandParameterList(String, String, TypedValue, Map) on line 790 Hibernate doesn't realise the closing bracket after the placeholder belongs to the sub query.
              Hide
              gbadner Gail Badner added a comment -

              Chris, can you check to see if this is still a problem in 4.3? If so, please open a new Jira issue.
              Thanks,
              Gail

              Show
              gbadner Gail Badner added a comment - Chris, can you check to see if this is still a problem in 4.3? If so, please open a new Jira issue. Thanks, Gail

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Development