openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Query using timestamp version field
Date Tue, 01 Mar 2011 22:16:27 GMT
Can I have you post your Entity? This seems to work with my unit test:

@Entity
public class TimestampedEntity {
    @Id
    @GeneratedValue
    private long id;

    @Version
    private Timestamp version;
...
}

        EntityManager em = emf.createEntityManager();
        String pql = "SELECT s FROM TimestampedEntity s WHERE s.version <
:endDate";
        Query queryObj = em.createQuery(pql);
        Timestamp t1 = new Timestamp((new Date()).getTime());
        queryObj.setParameter("endDate", t1);
        List<TimestampedEntity> scenarioList = queryObj.getResultList();

Thanks,
Rick

On Tue, Mar 1, 2011 at 3:58 PM, kostellodon <donald.g.kostello@citi.com>wrote:

> I'm doing this query within a unit test, and am using runtime enhancement
> via
> the javaagent.
>
> I've tried this with both 1.2.2 and 2.1.0 and see the same index out of
> bounds exception in both cases.
>
> Either querying another timestamp field or removing the version annotation
> from the update field causes the exception to go away.  Marking a field
> that
> is a Long as the version field also makes it go away, so it appears to be
> directly related to querying against a Timestamp version field.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message