Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to execute JPQL queries with a Historical Session?

There is an "eclipselink.history.as-of" query hint that you can use with a
JPA query to set the as of date.


Alfredo Osorio wrote:
> 
> Hello,
> 
> I'm using Historical Session to execute queries to retrieve past data.
> 
> I want to know if is it it possible to execute a JPQL using the
> HistoricalSession instead of the EclipseLink query language?
> 
> Right now I'm forced to do queries like this using EclipseLink Query
> Language:
> JpaEntityManager jpaEntityManager =
> entityManager.unwrap(JpaEntityManager.class);
> ClientSession clientSession =
> jpaEntityManager.getServerSession().acquireClientSession();
> AsOfClause asOfClause = new AsOfClause(date);
> Session historicalSession =
> clientSession.acquireHistoricalSession(asOfClause);
> ReadAllQuery historicalQuery = new ReadAllQuery(Employee.class);
> List<Employee> employees =
> (List<Employee>)historicalSession.executeQuery(historicalQuery);
> 
> I would like to do something like this whch uses JPQL :
> String jpql = "select e from Employee e";
> List<Employee> employees = entityManager.createQuery(jpql,
> Employee.class).getResultList();
> 
> instead of using the ReadAllQuery and still be using the Historical
> Session.
> Is it possible?
> If it is not possible I would like to contribute to implement it. Can
> someone tell me where to start?
> 
> Alfredo Osorio
>  		 	   		  
> 
> 


-----
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.eclipse.org/forums/index.php?t=thread&frm_id=111&S=1b00bfd151289b297688823a00683aca
EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/How-to-execute-JPQL-queries-with-a-Historical-Session--tp33498170p33544623.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top