Re: [Objectbridge-developers] optional relationships
Brought to you by:
thma
From: David F. <dw...@la...> - 2001-08-10 05:18:21
|
At 10:55 PM 8/9/2001, Dirk Olmes wrote: >David Forslund wrote: > > > > To illustrate things better I'll just give a short description of my > > > tables: I have a table 'Person' which has a to-many relationship to > > > the table 'Folder'. The 'Folder' table will later have a reflexive > > > relationship to itself (so I can have subfolders to every folder). > > > (BTW: is that possible with ObjectBridge right now?) > > > > Yes, it does. We are using it this way now. One of my applications > > has the same structure. It has an "Identity: object which contains many > > "Traits" Traits can contain other Traits. I have two tables Identity > and Trait >[...] > > > In order to model that, the 'Folder' table needs a foreign key which > > > can be NULL for the case that a folder has no parent folder. > > > > In my case I don't allow for a Trait to exist by itself, so a Trait > > has a Trait or an Identity as a parent. I don't formally use a > foreign key. > >Good to hear that. But how do you do the mapping? I currently have no >idea how to accomplish that without a foreign key. Or do you put code >into Trait to retrieve the parent? The Trait doesn't need to retrieve the parent (but it can return the id of its parent if it needs to be retrieved), but I do have code for the parent to retrieve the child if it isn't present. I think the OJB examples do not have foreign keys, either. Several DBMS' I deal with don't handle foreign keys correctly, anyway. Dave >-dirk > >_______________________________________________ >Objectbridge-developers mailing list >Obj...@li... >http://lists.sourceforge.net/lists/listinfo/objectbridge-developers David W. Forslund dw...@la... Computer and Computational Sciences http://www.acl.lanl.gov/~dwf Los Alamos National Laboratory Los Alamos, NM 87545 505-663-5218 FAX: 505-665-4939 |