One to one mapping with an intermediate table

1 view
Skip to first unread message

Roni Dover

unread,
Jul 2, 2009, 1:22:55 AM7/2/09
to nhusers
Hi!

I'm trying to find the correct way to map a one-to-one relationship
using an inbetween table.
For example, I have a Person table and a PersonConnection table (the
separate table is needed because the connection itself also has
properties). Each person can have only one connection with one other
person.
I'd also like the PersonConnection entry to be treated as "Orphan" and
deleted if both of the Person entries it connects are deleted.

I'd appreciate any ideas!

James Gregory

unread,
Jul 2, 2009, 8:45:53 AM7/2/09
to nhu...@googlegroups.com
I think you've really got a many-to-many there, with some artificial restrictions in your domain. You either need to create an entity for your intrim table, and then create two one-to-one's, or just map it as a many-to-many. If you go the m2m route you could map it as a field and create a property that just exposes the first item, but that's a little hackish.
Reply all
Reply to author
Forward
0 new messages