-->
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: joined-subclass mapping strategy
PostPosted: Wed Nov 08, 2006 2:32 pm 
Newbie

Joined: Wed Nov 08, 2006 1:57 pm
Posts: 2
I am working hard to replace our project's current persistence approach with NHibernate.

I have determined, I think, that the joined-subclass mapping strategy is the way to go given our database design.

I'll attempt to explain my problem with the following example.

I have a PhoneNumber object with the following class hierarchy:

> Item
> CommunicationItem
> PhoneNumber

Our database has corresponding ITEM, COMMUNICATIONITEM, and PHONENUMBER tables.

**The PHONENUMBER table inherits the column values from ITEM & COMMUNICATIONITEM via triggers.

When I load a PhoneNumber entity, the sql that's executed includes joins to ITEM and COMMUNICATIONITEM (as expected).

Since the values from the joined tables are already in the PHONENUMBER table (copied via triggers), is there a way to configure NHibernate to not include the joins to the 2 "inherited" tables?

_________________
jredin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 6:28 am 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
Hi.

I don't think you are doing it correct..

Or you don't make redundant information into your database, or you don't map your class PhoneNumber as joined-subclass (because it is not acting like one) and just map it like an individual class.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 1:30 pm 
Newbie

Joined: Wed Nov 08, 2006 1:57 pm
Posts: 2
Unfortunately, this is the (inherited) database schema that I have to work with. The idea behind the redundant data was to "speed" up queries.

If I use a single mapping file for the PhoneNumber table, when I save the PhoneNumber object, it needs to also potentially update the ITEM and COMMUNICATION item tables. I'm not sure how to accomplish this... maybe implement the IInterceptor and cascade the save to these tables?

I can't seem to come up with any other options (and I don't see the db schema changing any time soon).

_________________
jredin


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.