Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      When using the isMember operator on a collection of enums the enum parameter is not converted correct. In my attached test case I use hsql, which is throwing an exception:
      Caused by: java.sql.SQLSyntaxErrorException: incompatible data type in conversion

      Using an oracle-db I just get an empty result, because of the mismatch of the types of the parameter and the field.

      Expression<Set<SimpleEnum>> simpleEnums = root.get( Person_.enumCollection);
      
      // Using the correct collection of enums and an enum parameter
      cq.where(cb.isMember(SimpleEnum.A, simpleEnums));
      // leads to SQLSyntaxErrorException: incompatible data type in conversion in hsqldb
      
      Expression<Set<SimpleEnum>> simpleEnums = root.get( Person_.enumCollection);
      
      // Using the correct collection of enums and an enum parameter
      cq.where(cb.isMember(SimpleEnum.A, simpleEnums));
      // leads to SQLSyntaxErrorException: incompatible data type in conversion in hsqldb
      
      // Here tricking hibernate, telling that it is a collection of strings and passsing a string argument.
      Expression<Collection<String>> simpleEnums = root.get("enumCollection");
      
      cq.where(cb.isMember("A", simpleEnums));
      // no exception and correct return valus
      

        Attachments

          Issue links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 14m
                  14m