[hibernate-users] Stale query cache by column
Luiz Fernando O. C. Real
luiz.real at caelum.com.br
Mon Apr 4 14:39:08 EDT 2011
Hi, again
Thanks for the reply, Joe. I've checked out the event system and could not
find anything helpful. It seems that the generated events are only fired
after the cache is invalidated.
I've found a way to do this implementing a QueryCache, but it's not the most
elegant solution. I verify the query to be retrieved from the cache via the
toString() method in the QueryKey object. If the SQL matches the one I'm
trying to turn stale cache tolerant, I ignore the timestamp.
Is there a better way to do this, to look at the query being passed?
Wouldn't it be nice to have a getter for it in the QueryKey class?
Thanks
--
Luiz F. O. Corte Real
Vida Geek
http://vidageek.net
Caelum | Ensino e Inovação
http://www.caelum.com.br
On Thu, Mar 24, 2011 at 12:16 PM, Haswell, Joe <josiah.d.haswell at hp.com>wrote:
> I’d check out the event system. If a particular event invalidates your
> cache, just clear it or the region of it that’s invalid.
>
>
>
> Joe H. | HP Software
>
>
>
> *From:* hibernate-users-bounces at lists.jboss.org [mailto:
> hibernate-users-bounces at lists.jboss.org] *On Behalf Of *Luiz Fernando O.
> C. Real
> *Sent:* Thursday, March 24, 2011 9:06 AM
> *To:* hibernate-users
> *Subject:* [hibernate-users] Stale query cache by column
>
>
>
> Hi,
>
> I'm trying to implement a custom QueryCache that, like the example in
> http://community.jboss.org/wiki/QueryCache, does not invalidate some
> existing register is updated in a specific table. However, unlike the
> example, I'd like to do that by analyzing which columns were changed in an
> update.
>
> More precisely, I have an User table, which has a lastLogin column. I'd
> like to keep the QueryCache valid when I update the lastLogin of an User.
>
> I haven't found any way to do that yet. Is that possible?
>
> Thanks in advance.
>
> --
> Luiz F. O. Corte Real
>
> Vida Geek
> http://vidageek.net
>
> Caelum Objects
> http://www.caelumobjects.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-users/attachments/20110404/c435df21/attachment.html
More information about the hibernate-users
mailing list