Hi,
I'm quite newbie on Hibernate and i would ask you about my db design and if it's make sense or not according to what i would like to get.
Let's say i have two things to manage in my app: people and their relations. So i have p1 and p2, my two guys. Two people could share several relationships simultaneoulsy: like coworkers, friends, etc.
So until now, i made two tables in my db: people (people_uuid, name) relationship (relation_uuid, people1, people2, relation_type)
In my people class, i would like to have a getRelations method, but here comes the trouble: the current guy could be in column people1 or people2 in my relation table, so i don't know how to set the mapping so that when i call my getRelations method, i get every relation (including relations where he's set in people1 column as much as those where he's set in people2 column). How should i proceed to map this correctly? Is my db design correct, and does it fit to what i want to do with Hibernate?
Thank you very much by advance,
SJ.
|