I am by no means an OpenJPA expert, but I did see something related to this when reading the docs yesterday. OpenJPA has a QueryResultsCache where it keeps the results of a query so if you run the query again you get the same results (I'm not sure if that is what you want). Here is the code from the docs:

OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(emf);
QueryResultCache qcache = oemf.getQueryResultCache();
EntityManager em = emf.createEntityManager();

Query pinQuery = em.createQuery(...).
    setParameter(0, paramVal0).
    setParameter(1, paramVal1);
qcache.pin(pinQuery);
Query unpinQuery = em.createQuery(...).
    setParameter(0, paramVal0).
    setParameter(1, paramVal1);
qcache.unpin(unpinQuery);


Hope that helped.

-dain

On Dec 8, 2006, at 8:04 PM, roger.keays wrote:


Hi,

I'm trying to use OpenJPA's fetch plan extensions to have a query return a large result set. It seems to work okay, except that the LRS gets closed / detached with the EntityManager, which only makes it useful for one request. Is it possible to have the LRS stay open after the em has been disposed?

Thanks,

Roger
--
View this message in context: http://www.nabble.com/extending-the- life-of-a-LRS-query-tf2784490.html#a7769269
Sent from the open-jpa-dev mailing list archive at Nabble.com.

Reply via email to