Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: query
    • Labels:
      None
    • Environment:
      Linux and OS X.

      Description

      I just updated to v2.1.0 from v2.0.1 and noticed that a query using TYPE()
      <> X is no longer working. I have an abstract base class and two
      subclasses. My query asks for all but one of the subclasses, like this:

      SELECT d FROM AbstractClass d WHERE d._state = :state AND TYPE(d) <>
      SubClassTwo

      When I run this query with v2.1.0, the SQL is generated as if the query
      said
      "TYPE(d) = SubClassTwo", resulting in a match on
      the SubClassTwo discriminator. I found a work-around using NOT IN:

      SELECT d FROM AbstractClass d WHERE d._state = :state AND TYPE(d) NOT IN
      (SubClassTwo)

      1. type-function-bug-test.tar.gz
        6.23 MB
        Brian Gebala
      2. OPENJPA-2004.ut.patch
        1 kB
        Rick Curtis

        Activity

        Brian Gebala created issue -
        Brian Gebala made changes -
        Field Original Value New Value
        Description I just updated to v2.1.0 from v2.0.1 and noticed that a query using TYPE()
        <> X is no longer working. I have an abstract base class and two
        subclasses. My query asks for all but one of the subclasses, like this:

        SELECT d FROM AbstractClass d WHERE d._state = :state AND TYPE(d) <>
        SubClassTwo

        When I run this query with v2.1.0, the SQL is generated as if the query
        said
        "TYPE(d) = SubClassTwo", resulting in a match on
        the SubClassTwo discriminator. I found a work-around using NOT IN:

        SELECT d FROM AbstractClass d WHERE d._state = :state AND TYPE(d) NOT IN
        (SubClassThree)
        I just updated to v2.1.0 from v2.0.1 and noticed that a query using TYPE()
        <> X is no longer working. I have an abstract base class and two
        subclasses. My query asks for all but one of the subclasses, like this:

        SELECT d FROM AbstractClass d WHERE d._state = :state AND TYPE(d) <>
        SubClassTwo

        When I run this query with v2.1.0, the SQL is generated as if the query
        said
        "TYPE(d) = SubClassTwo", resulting in a match on
        the SubClassTwo discriminator. I found a work-around using NOT IN:

        SELECT d FROM AbstractClass d WHERE d._state = :state AND TYPE(d) NOT IN
        (SubClassTwo)
        Hide
        Brian Gebala added a comment -

        Unit test showing this bug. Execute "ant run" after creating the test DB using widget.sql.

        Show
        Brian Gebala added a comment - Unit test showing this bug. Execute "ant run" after creating the test DB using widget.sql.
        Brian Gebala made changes -
        Attachment type-function-bug-test.tar.gz [ 12480281 ]
        Hide
        Rick Curtis added a comment -

        Attaching an OpenJPA unit test. I also confirmed that this is a regression from 2.0.x -> 2.2.x ( I didn't test this on 2.1).

        Show
        Rick Curtis added a comment - Attaching an OpenJPA unit test. I also confirmed that this is a regression from 2.0.x -> 2.2.x ( I didn't test this on 2.1).
        Rick Curtis made changes -
        Attachment OPENJPA-2004.ut.patch [ 12480660 ]
        Michael Dick made changes -
        Fix Version/s 2.1.1 [ 12316191 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Brian Gebala
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development