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

        Albert Lee created issue -
        Albert Lee made changes -
        Field Original Value New Value
        Attachment OPENJPA-2425.patch [ 12601212 ]
        Albert Lee made changes -
        Patch Info Patch Available [ 10042 ]
        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.
        Heath Thomann made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.1.2 [ 12317142 ]
        Fix Version/s 2.3.0 [ 12319463 ]
        Fix Version/s 2.2.1.1 [ 12323484 ]
        Fix Version/s 2.2.3 [ 12324305 ]
        Resolution Fixed [ 1 ]
        Mark Struberg made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        44d 3h 10m 1 Heath Thomann 17/Oct/13 23:29
        Resolved Resolved Closed Closed
        596d 22h 50m 1 Mark Struberg 06/Jun/15 22:19

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development