[jboss-user] [JBoss Cache: Core Edition] - Re: very strange behaviour of jboss cache 1.4.1
bstansberry@jboss.com
do-not-reply at jboss.com
Sun Feb 1 16:11:28 EST 2009
Yes, see comment I posted a half-hour or so ago on the other thread.
If you execute native queries, Hibernate has no way to know what changes you are making in the underlying database, and is forced to aggressively clear the cache to avoid leaving stale data.
Same thing applies if you do bulk updates -- i.e. update a bunch of entities that match a where clause -- since Hibernate doesn't know what entities match the where clause. So it is forced to remove all entities of the particular type from the cache.
If you query for the entities that match your where clause and then iterate over them making the update one by one, Hibernate knows what entity instance was changed and can update the cache for just that one instance. Of course if your where clause matches a lot of entities, it might be more performant to accept losing the cache contents and do the bulk update.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206134#4206134
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206134
More information about the jboss-user
mailing list