-->
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.  [ 3 posts ] 
Author Message
 Post subject: Disable Cache for specific Objects
PostPosted: Tue Aug 21, 2007 3:37 am 
Newbie

Joined: Tue Aug 21, 2007 2:55 am
Posts: 3
Hi,

We have an application which is consisted of 2 ears: each ear has its own hibernate session factory.
There are common objects for those 2 ears (each ear represents a product), managed by hibernate (persistent object).

We work with secondary-level cache, but we would like to disable caching for those common objects only, and to gain the benefit of it for the rest of the application. The reason is the need of reflecting each change between the 2 apps.

Is there a possibility to ignore the cache for few objects only?
I wasn't able to find a configuration on the level of object.

Thanks a lot,
Moti

Hibernate version: 3.0.5

Name and version of the database you are using: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 5:41 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

to use second-level cache you should mention in every hibernate mapping file
like <cache usage="read-only"/>

so remove those entry to disable second-level cache for selected element



Amila

(Don't forget to rate if helps)


Top
 Profile  
 
 Post subject: You'right, but I've mis introduced my question/problem
PostPosted: Wed Aug 22, 2007 10:06 am 
Newbie

Joined: Tue Aug 21, 2007 2:55 am
Posts: 3
At the beginning I suspected that working with 2nd-level cache might cause us problems: data won't reflect immediately between 2 application, working against the same DB (Oracle 10g).

But than, after few tests, and re-thinking, the problem exists no matter what kind of caching method I use.

If I create new 2 elements, one from each application, at the same time - the same Id will be supplied to both new created element causing one of them to fail (pk/unique constraint violation).

Meaning, I need to change the Id generation mechanism from general "increment" to "sequence" or any other shared (on physical level) resource.
There is no way to enforce 2 session factories, with 2 sessions to considerate each other - only on DB level (which strongly not supported by Informix 10 sequence)

Am I right? Is that the right way to implement object creation by 2 applications?

Another question raised by the same issue is the consistency when updating the same elements from both applications: I saw an advice to use timestamp or version - could it help to check one object is not occupied by other application? (this case will rarely occur if at all - but it's still interesting)

Thanks a lot,
Moti


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.