-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping help
PostPosted: Thu Jun 29, 2006 7:47 pm 
Beginner
Beginner

Joined: Mon Jun 19, 2006 9:21 pm
Posts: 25
So I'm trying to make a junction table that will handle all the id1<->id2 type of relationships I have. I use a type column in the db that tells me which relationship the two id's refer to. The problem is I have no idea how to map this in hibernate. If I do the normal mappings I've seen, it looks like it would grab all the relationships it sees in the table, even though it should only grab those with type x.
I know that I could use a where clause to say give me only these types, but I was hoping for a more transparent way to do it that would have hibernate figure it out.
If there isn't a way, I'll probably make a seperate table for each many-to-many case just because it'll get fairly confusing in the program otherwise. That, and currently there are only four tables that do that, but I anticipate more in the future which is why I would like to have just one junction table.
Also, just some thoughts about which is better practice when designing a db would be appreciated too (figure the one table will just make things a bit neater since there aren't a bunch of little tables all over the place). The design isn't completely in stone as far as little things like that are concerned.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.