OpenJPA
  1. OpenJPA
  2. OPENJPA-2435

Version field in a projection always returned as an Integer.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0, 2.2.2, 2.2.1.1, 2.3.0
    • Fix Version/s: 2.1.2, 2.2.1.1, 2.2.3, 2.3.0
    • Component/s: jdbc
    • Labels:
      None

      Description

      I've recreated an issue where a @Version field is returned as an Integer when the field is defined as a Long or Short. To explain, lets take this entity:

      @Entity
      public class LongVersionEntity implements Serializable {
      .......
      @Version
      protected Long version;
      .......

      With this entity take the following query:

      String str = "SELECT o.id, o.version FROM LongVersionEntity o";
      Query query = em.createQuery(str);
      List<Object[]> objectList = query.getResultList();
      for (Object[] objects : objectList) {
      objects[1].getClass() //Will return Integer.

      Notice in this query we are selecting the version field. When iterating over the results, we will find that objects[1].getClass() will return Integer, rather than Long. The same seems to be true for the other supported types, except for Timestamp.
      I will provide a full test in the next day or so.

      Thanks,

      Heath

        Activity

        Hide
        ASF subversion and git services added a comment -

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

        OPENJPA-2435: Version field in a projection always returned as an Integer.

        Show
        ASF subversion and git services added a comment - Commit 1533280 from Heath Thomann in branch 'openjpa/branches/2.1.x' [ https://svn.apache.org/r1533280 ] OPENJPA-2435 : Version field in a projection always returned as an Integer.
        Hide
        ASF subversion and git services added a comment -

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

        OPENJPA-2435: Version field in a projection always returned as an Integer. Merged 2.1.x changes to 2.2.1.x.

        Show
        ASF subversion and git services added a comment - Commit 1533281 from Heath Thomann in branch 'openjpa/branches/2.2.1.x' [ https://svn.apache.org/r1533281 ] OPENJPA-2435 : Version field in a projection always returned as an Integer. Merged 2.1.x changes to 2.2.1.x.
        Hide
        ASF subversion and git services added a comment -

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

        OPENJPA-2435: Version field in a projection always returned as an Integer. Merged 2.1.x changes to 2.2.x.

        Show
        ASF subversion and git services added a comment - Commit 1533287 from Heath Thomann in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1533287 ] OPENJPA-2435 : Version field in a projection always returned as an Integer. Merged 2.1.x changes to 2.2.x.
        Hide
        ASF subversion and git services added a comment -

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

        OPENJPA-2435: Version field in a projection always returned as an Integer. Merged 2.1.x changes to 2.3.x.

        Show
        ASF subversion and git services added a comment - Commit 1533288 from Heath Thomann in branch 'openjpa/branches/2.3.x' [ https://svn.apache.org/r1533288 ] OPENJPA-2435 : Version field in a projection always returned as an Integer. Merged 2.1.x changes to 2.3.x.
        Hide
        ASF subversion and git services added a comment -

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

        OPENJPA-2435: Version field in a projection always returned as an Integer. Merged 2.1.x changes to trunk.

        Show
        ASF subversion and git services added a comment - Commit 1533289 from Heath Thomann in branch 'openjpa/trunk' [ https://svn.apache.org/r1533289 ] OPENJPA-2435 : Version field in a projection always returned as an Integer. Merged 2.1.x changes to trunk.

          People

          • Assignee:
            Heath Thomann
            Reporter:
            Heath Thomann
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development