[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] EntityManager and historical sessions
|
EclipseLink does not currently provide any JPA API for using a historical
session or queries. There is an enhancement request for this that you can
vote for,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220807
A historical session is a non-transactional session, so you cannot acquire
it from a UnitOfWork. The historical session is for querying a past time,
if you haven't committed the data yet, it will not exist in a past time, so
I'm confused as to why you would want to do this?
You can also use an asOf clause in any ReadAllQuery or ReadObjectQuery, and
do not need a historical session to do this.
Magnus Heino wrote:
>
> Hi.
>
> 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()
>
> .acquireClientSession().acquireHistoricalSession(asOfClause);
>
> 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
>
-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://www.nabble.com/EntityManager-and-historical-sessions-tp19853998p19857832.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.