I'm using hibernate to run a named JPA query.
The query is executed twice from the same session, the query should return same rows because database doesn't change in the mean time.
To my surprise, the objects returned from the query are different from these two query result lists (data is same but objects are different). With the first-level cache enabled (by default), I thought the second query should return the same objects as the first query?
The query is a simple named-query:
SELECT e from TABLE e where e.name=?1
Is cache bypassed by the query somehow? Or my understanding of the first-level cache is wrong?