-->
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.  [ 4 posts ] 
Author Message
 Post subject: Real write behind caching
PostPosted: Tue Feb 08, 2005 7:32 am 
Beginner
Beginner

Joined: Tue Feb 08, 2005 7:01 am
Posts: 21
Hibernate version: 3.0

What is the best way to implement seamless out-of-session write behind within a domain model and still use Hibernate?

I know there is a session level write behind cache, but I feel this is not what I need. A few domain classes are updated so frequently, that it is not feasible to always issue an sql update in every transaction. On the other hand it is perfectly safe to save these objects every 5 minutes or so, and only cache their status in the meantime.

After reading Hibernate in Action and the reference doc, I considered a custom persister (but it seems that a class must have exactly one persistence strategy, it cannot use once a custom persister for delayed update, then the default persister to actually update the database). Another but somehow awkward solution: a custom type used in the classes referring to these frequently updated classes. This type would replace standard associations and return the same frequently updated object.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 8:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I don't see why you couldn't proxy out the underlying persister by implementing EntityPersister and some of its subinterfaces and delegating to a "real" instance of SingleTableEntityPersister.

What would be the problem with that approach?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 8:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Note that the Batcher can also be replaced in Hibernate3, which could also probably be used to accumulate incremental changes behind a proxy PreparedStatement.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 9:20 am 
Beginner
Beginner

Joined: Tue Feb 08, 2005 7:01 am
Posts: 21
I started using Hibernate a week ago, so I can only have feelings about the consequences of any of these options. The EntityPersister interface is frightening enough so I wanted to ask if that is the appropriate extension point, I don't see any definitive problem with it.


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