-->
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.  [ 2 posts ] 
Author Message
 Post subject: Creating my own ClassPersister
PostPosted: Sun Dec 21, 2003 2:04 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
Hello,

I'm in a situation where I'm trying to make separate databases live peacefully together. Hibernate makes that pretty easy with the CompositeUserType. Using CompositeUserType, I can use any session I need to load an Entity!

I was looking at ClassPersister, though, and wondering if this might be a better solution for "objects living in different databases" than CompositeUserType is.

I was thinking of subclassing EntityPersister and overriding the session that gets used in "load", "insert", "update", and "delete". Could it be that easy -- take control over the session used in EntityPersister?

And, would this work OK with "joins" across objects in different databases, then? CompositeUserType knows how to dereference the properties properly so that query joins on objects in separate databases works fine. Will EntityPersister be prepared for this?

If not, I'll just stick with CompositeUserType. :)

Thanks for you time!

Ryan


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 21, 2003 3:24 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
As an amendment to the above, I noticed that EntityPersister takes a SessionFactoryImplementor in the constructor. Does this mean that it only supports one particular class per session factory?

In the example from my previous post, one class in our system may be spread amongst many different session factories (databases locations). The idea is to make this distribution transparent to the code. This works OK with CompositeUserType, but I'm wondering if it can be achieved more elegantly with a customer perister.

Thanks again,

Ryan


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