OpenJPA
  1. OpenJPA
  2. OPENJPA-662

Version field returns null when explicitly projected in SELECT clause

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-M1
    • Component/s: query
    • Labels:
      None

      Description

      With this entity:

      An entity has a version field, with AUTO strategy.

      @Entity
      public class Department

      { @Id private int id; @Version @GeneratedValue(strategy=GenerationType.AUTO) private int myVersion; private String name; }

      A record is inserted...

      Department d = new Department();
      d.setName("SALES");
      em.getTransaction().begin();
      em.persist(d);
      em.getTransaction().commit();
      em.close();

      ...and queried.

      If the select is over the entity, "SELECT d from Department d", the version field is set up correctly in the returned entity.

      But if the version field is explicitly projected, "SELECT d.id, d.myVersion, d.name from Department d", the id and the name values are returned fine, but the myVersion value is null.

        Issue Links

          Activity

          Dinkar Rao created issue -
          Pinaki Poddar made changes -
          Field Original Value New Value
          Assignee Pinaki Poddar [ ppoddar@apache.org ]
          Pinaki Poddar made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Donald Woods made changes -
          Fix Version/s 2.0.0-M1 [ 12313624 ]
          Rick Curtis made changes -
          Link This issue is related to OPENJPA-2343 [ OPENJPA-2343 ]

            People

            • Assignee:
              Pinaki Poddar
              Reporter:
              Dinkar Rao
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development