1 Reply Latest reply on Mar 31, 2010 6:14 PM by Jean Luc

    seams entityManager and stale records

    nimo stephan Master

      I am using a query to return a list of records.

      Look at that scenario:

      I change record X but do not persist/flush it!

      Then I make a query by entityManager.createNamedQuery(..).

      This query does contain the origin record X, I call it X1.

      The problem here is, that the new retrieved record X1 has the same state as the transient X. How can I avoid this?

      I do want to retrieve the records by its origin state even there are records in transient state which might to be changed by me.

      When using flush or refresh the record X is also be refreshed/flushed.

      Is the only solution to copy the record X to another object-instance?