Question

I am trying to utilize EclipseLink expression since I found it quite convenient for dynamically combining query conditions.But that must be working with ReadAllQuery which do not have QueryHint (for batching) options that is A Must for my application.

On the other hand, to use the JPA Query which has this hint capability you must let go EclipseLink expression tool.

What is the way to use EclipseLink Expression and QueryHint in tandem?

it seemed that ReadAllQuery has several related Method for setting fetching options, but if you google it ,you find nothing but source codes from repository.

Was it helpful?

Solution

Batch reading is described with references to the native EclipseLink query framework here: http://wiki.eclipse.org/Using_Basic_Query_API_%28ELUG%29#Using_Batch_Reading

You can also build your query object then set it in the JPA query object for execution using the EJBQueryImpl setDatabaseQuery(query) method. This would allow you to use the JPA setHint api afterward, but I find the native api gives you more control and only use it to execute the query with the EntityManager. EJBQueryImpl is the EclipseLink JPA Query implementation, so you may need to use the unwrap method to get at it on a container.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top