Re: Many To Many relationship and D2W
Re: Many To Many relationship and D2W
- Subject: Re: Many To Many relationship and D2W
- From: Art Isbell <email@hidden>
- Date: Wed, 18 Dec 2002 15:44:48 -1000
On Wednesday, December 18, 2002, at 12:25 PM, Smadja Serge wrote:
I'm quiet new to WebObjects (5.2). I have an Oracle database with some
many to many relationships that contain an attribute like say a
quantity. I wanted to use D2W to insert data into my database. D2W
works well for my one to many relationships but each time I want to
insert data ("the quantity") into my "many to many" table, it tries to
generate a primary key for this table and of course it can't because
this table holds the two primary keys from the two main tables !! Is
there a way to still use D2W and insert data with many to many
relationship containing attributes ?
I do this frequently with a different database, but this doesn't sound
like a database-specific problem. It sounds more like an
incorrectly-modeled many-to-many relationship. Because of the
complexity of the underlying relationships necessary to model a
many-to-many relationship, I always use EOModeler to create a
many-to-many relationship.
A <<-->> B is modeled as A <-->> AB <<--> B
If I want to access an attribute in the correlation (or join) entity
AB, I delete the flattened to-many relationships A -->> B and B -->> A.
I make the underlying to-many relationship A -->> AB and B -->> AB
class properties. I make the underlying to-one relationships AB --> A
and AB --> B class properties. But I don't change any of the
relationship's properties. Your A -->> AB and/or B -->> AB
relationships may not have their "Propagate Primary Key" property set.
If not, and if you generated the SQL to create these tables using
EOModeler, table AB may have had an Oracle sequence created to generate
primary keys for table AB.
When your eomodel is configured correctly, D2W should be able to
generate pages that will allow you to manage data in A, AB, and B.
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.