Skip to main content

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

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

Back to the top