-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: second level caching with clustered app servers
PostPosted: Mon Jan 10, 2005 12:52 pm 
Newbie

Joined: Mon Jan 10, 2005 12:25 pm
Posts: 3
hi folks

hibernate-3.0beta1.jar

is it correct to create a no-op second level cache provider that never puts anything in the cache and that always says an object is not present. like this i do not have to get involved with replicating caches over a cluster of WebSphere AppServers?

if i can't do this and i have to use a cluster-aware cache provider.....my issue is:
i have a piece of work executed within a transaction that proceeds to completion on the appserver without throwing an exception. the transaction control is delegated to websphere. subsequently the second level cache replication fails. does this rollback the peice of work that worked ok? why should a transaction rollback because a server that was never involved with it couldn't update its cache?

from using toplink, i learnt (maybe i am wrong with hibernate..?) that clustered cache is more trouble than it is worth. any experiences of using clustered caches with hibernate/ websphere?

any response much appreciated..am i missing something?

paul


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 5:46 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Why not just not using the second level cache (default configuraton)?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 8:02 pm 
Newbie

Joined: Mon Jan 10, 2005 12:25 pm
Posts: 3
hi and thanks

maybe i didn't explain what i wanted to say properly...

because i am using a clustered application server configuration,
i don't want any second level cache at all: i always want to hit the database.
maybe i can set an expiry time of zero but this seems to be a cheat and anyway effort will be expended populating and evicting to/from the cache. so what i proposed was to write my own cache provider and use it. this cache will be very dumb and a request will never result in a cache hit because the implementation of the cache will always say the required object is absent from the cache.

i tried not specifying any second level cache in my hibernate conf but i got a noclassdeffound for ehcache which says to me this is the default cache
provider. i don't want any cache.

this is for a variety of reasons that includes, but is not limited to:
-for some very frequently used processes we use v complex pl/sql and for performance reasons, some of the CRUD of the application has to use stored procedures. second level caching means everyone writing to the db has to go via the cache, otherwise it will contain stale data. the massive majority of the operations is simple CRUD involving no more that 2 or 3 joins: a perfect match for ORM.

-i am not sure of the effectiveness of a clustered cache in the event that one of the participants fails. surely some code on startup after a failure will need to repopulate the server node with a fresh cache. equally, like i said, i do not want to rollback a transaction for the sole reason that one of the participating caches could not update itself.

hope this is clearer

thanks again

paul


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 8:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just don't put any <cache> tags in your mapping files, then no second-level caching will be used.


Top
 Profile  
 
 Post subject: cannot disable cache
PostPosted: Tue Jan 11, 2005 7:36 am 
Newbie

Joined: Mon Jan 10, 2005 12:25 pm
Posts: 3
this doesn't work for me...

i have to reference to any <cache> tags in my mapping xml, however the hibernate startup says ehcache will be used

what am i doing wrong?

thanks

paul


[1/11/05 11:13:03:688 GMT] 20014a12 SettingsFacto I org.hibernate.cfg.SettingsFactory Automatic session close at end of transaction: disabled
[1/11/05 11:13:03:688 GMT] 20014a12 SettingsFacto I org.hibernate.cfg.SettingsFactory Cache provider: org.hibernate.cache.EhCacheProvider
[1/11/05 11:13:03:703 GMT] 20014a12 SettingsFacto I org.hibernate.cfg.SettingsFactory Second-level cache: enabled
[1/11/05 11:13:03:703 GMT] 20014a12 SettingsFacto I org.hibernate.cfg.SettingsFactory Optimize cache for minimal puts: disabled

here's my mapping doc

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "C:\dev\projects\hibernateeval\dtd\hibernate-mapping-3_0_dtd.dtd">
<hibernate-mapping>

<class name="vo.Risk" schema="turnerp" table="RISK">
<id name="riskId" column="RISK_ID" >
<generator class="sequence">
  <param name="sequence">RISK_SEQ</param>
</generator>
</id>
<property name="umr" column="UMR" />
<property name="description" column="DESCRIPTION" />
<property name="version" column="VERSION" />
<property name="createdDate" column="CREATED" />

</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 11, 2005 8:33 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
That doesn't mean its active for any persistent classes, it will always be turned on and "do nothing" however.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.