Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] EntityManager and historical sessions


I have a HistoryPolicy configured for my entity that is managed by my entitymanager.

I begin a transaction, persist this entity, flush, change it, flush, change it, flush, and notice that rows are added by the HistoryPolicy to my _HIST tables just as expected.

This is the way I currently aquire my historical session;

Session historicalSession = this.entityManager.getServerSession()

Historical queries are now in a separate database session from the one that I flushed and added things to above, since that transaction isn't commited at this moment.

Is it possible to have the historical session use the same database session (or whatever the name for this is) as the current session used by the transaction that the entityamanger is using so that I can do historical queries on the data that is about to be commited?

Also, is it possible to use JPA queries to access historical data or do I have to use eclipselink apis like ReadAllQuery etc? If not, is this likely to change with JPA 2.0 when we will have a standard query api like this?

 /Magnus Heino

Back to the top