Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » (no subject)
(no subject) [message #696991] Fri, 15 July 2011 09:21
Sebastian is currently offline SebastianFriend
Messages: 26
Registered: July 2009
Junior Member
Hi All,

I have a cached namedquery

@NamedQuery(name = "CoverholderAgreement.all",
query = "SELECT c FROM CoverholderAgreement c",
hints = {
@QueryHint(name = QueryHints. QUERY_RESULTS_CACHE, value=HintValues.TRUE)

which speed up my code significantly... (so far so good)

in some part of the application I add and delete objects... doing that, the namedquery cache is not automatically refreshed so I need to refresh it by hand at every occation that I modify the DB:

> utx.commit();
> ((JpaEntityManager)em.getDelegate()).getServerSession().getIdentityMapAccessor().clearQueryCache("CoverholderAgreement.all");

I do not like this option as it leads to generate new bugs... think about the case when I persist another object which by CASCADING persists a new CoverholderAgreement and I forget to refresh the namedquery cache... (this things hapends specially after some time or when future developers maintain the code and they are not aware of some cached namedquery)...

so just wondering if there is a better way for doing it ????

thanks !
Previous Topic:(no subject)
Next Topic:(no subject)
Goto Forum:

Current Time: Mon Apr 12 23:47:12 GMT 2021

Powered by FUDForum. Page generated in 0.01537 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top