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: Mapping Confusion
PostPosted: Wed Jul 19, 2006 2:46 pm 
Newbie

Joined: Wed Jul 19, 2006 1:56 pm
Posts: 1
Hibernate version: 3.1

Greetings,

I'm in the process of refactoring a legacy app we use in-house and thought I would integrate Hibernate. I have the following table schema and am having a heck of a time trying to figure out how to map it.

Image

My original idea was to map the CATEGORY_* tables as joined-subclasses of the CATEGORY table each with a Set of their corresponding 'items'. The CATEGORY table is mapped as an abstract superclass to the CATEGORY_* tables/classes. This doesn't appear to work as the CATEGORY_* tables have their own primary key. Further, I don't think I'm approaching this correctly.

Am I even thinking about this properly?
Any suggestions on a different strategy to solve this?

Many thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 20, 2006 12:58 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The category_* tables are join tables with their own primary key. This is almost a many-to-many mapping, except you have to implement separate classes for the category_* tables (because of the ID), and then have three one-to-many collections from category to those classes, and many-to-one unique="true" from each of those to the contact/note/list tables.

If you can configure your DB to autogenerated the ID columns of the category_* tables, then you can simply not map the ID columns, and make those simple many-to-many relationships, where the category_* tables are referred to only in the <set> elements in the category mapping.

_________________
Code tags are your friend. Know them and use them.


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.