openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: extending the life of a LRS query
Date Sat, 09 Dec 2006 17:23:31 GMT
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);;
Query unpinQuery = em.createQuery(...).
     setParameter(0, paramVal0).
     setParameter(1, paramVal1);

Hope that helped.


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: 
> life-of-a-LRS-query-tf2784490.html#a7769269
> Sent from the open-jpa-dev mailing list archive at

View raw message