Let's say I have two tables... Boy (boy_id, girl_name) and Girlfriend (girl_id, girl_name) ... I designed a third table boyHasGirl (boy_id, girl_id) to express that a boy has a girl friend.
Now how do I model this using j2ee?
This is a M:N relationship. Using the Mastering EJB's book I found here (very nice book btw) it has advised that I can "fake" the relationship by breaking it down into two one-many relationships. However the problem I found with that is that when it is broken down the relationship fields only reside on the third table. Say using the fake method, the BoyHasGirl bean would have relationship fields boy and girl (getBoy,setBoy,getGirl,getBoy)..
But it is not obvious to me using that route how I can simply say given a boy's id, how can you obtain all his girl friends?
Can I use ejbql as a solution?