OpenJPA
  1. OpenJPA
  2. OPENJPA-2425

SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.2, 2.2.1.1, 2.2.3, 2.3.0
    • Fix Version/s: 2.1.2, 2.2.1.1, 2.2.3, 2.3.0
    • Component/s: jdbc
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      If entity fields is annotated with,

      @ExternalValues(

      { "SMALL=SML", "MEDIUM=MID", "LARGE=LRG" }

      )
      private String s1;

      Object query returns umapped value in the object,
      Query q = em.createQuery("SELECT a from EntityA a");
      EntityA aPrime = (EntityA) q.getSingleResult();
      Assert.assertEquals("SMALL", aPrime.getS1());

      However, field query returns mapped value from the datastore:
      q = em.createQuery("SELECT t0.s1 FROM EntityA t0");
      List<Object[]> res = q.getResultList();
      Iterator<Object[]> itr = res.iterator();
      Object[] values = itr.next();
      Assert.assertEquals("SMALL", values[1]); <<< FAILED here, values[1]=="SML"

      This problem also causes a similarly structured CritieriaAPI query to return incorrect values.

      If the field type is boolean, even if the database has "true" value, both of the above scenario will return false, due to new Boolean("non-true") always return false.

        Activity

        Hide
        ASF subversion and git services added a comment -

        Commit 1530146 from Heath Thomann in branch 'openjpa/branches/2.1.x'
        [ https://svn.apache.org/r1530146 ]

        OPENJPA-2425: SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.1.x.

        Show
        ASF subversion and git services added a comment - Commit 1530146 from Heath Thomann in branch 'openjpa/branches/2.1.x' [ https://svn.apache.org/r1530146 ] OPENJPA-2425 : SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.1.x.
        Hide
        ASF subversion and git services added a comment -

        Commit 1530347 from Heath Thomann in branch 'openjpa/branches/2.2.1.x'
        [ https://svn.apache.org/r1530347 ]

        OPENJPA-2425: SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.2.1.x.

        Show
        ASF subversion and git services added a comment - Commit 1530347 from Heath Thomann in branch 'openjpa/branches/2.2.1.x' [ https://svn.apache.org/r1530347 ] OPENJPA-2425 : SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.2.1.x.
        Hide
        ASF subversion and git services added a comment -

        Commit 1530364 from Heath Thomann in branch 'openjpa/branches/2.2.x'
        [ https://svn.apache.org/r1530364 ]

        OPENJPA-2425: SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.2.x.

        Show
        ASF subversion and git services added a comment - Commit 1530364 from Heath Thomann in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1530364 ] OPENJPA-2425 : SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.2.x.
        Hide
        ASF subversion and git services added a comment -

        Commit 1530368 from Heath Thomann in branch 'openjpa/trunk'
        [ https://svn.apache.org/r1530368 ]

        OPENJPA-2425: SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to trunk.

        Show
        ASF subversion and git services added a comment - Commit 1530368 from Heath Thomann in branch 'openjpa/trunk' [ https://svn.apache.org/r1530368 ] OPENJPA-2425 : SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to trunk.
        Hide
        ASF subversion and git services added a comment -

        Commit 1533243 from Heath Thomann in branch 'openjpa/branches/2.3.x'
        [ https://svn.apache.org/r1533243 ]

        OPENJPA-2425: SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.3.x.

        Show
        ASF subversion and git services added a comment - Commit 1533243 from Heath Thomann in branch 'openjpa/branches/2.3.x' [ https://svn.apache.org/r1533243 ] OPENJPA-2425 : SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.3.x.

          People

          • Assignee:
            Albert Lee
            Reporter:
            Albert Lee
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development