• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Many problems for Many To Many Relationships across Databases
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Many problems for Many To Many Relationships across Databases


  • Subject: Re: Many problems for Many To Many Relationships across Databases
  • From: Art Isbell <email@hidden>
  • Date: Sun, 2 Mar 2003 14:06:00 -1000

On Sunday, March 2, 2003, at 01:24  PM, Riaz Lalehzari wrote:

How can I make a many-to-many relationship work across two databases? I have one Table and the Join Table on one DB and the third Table on another DB. Each DB has its own EOModel file and I know that flattened relationships at least DO NOT work across multiple databases (foreign key problems). How do I do this manually?

What has worked for me is to create the many-to-many relationship manually because EOModeler cannot create a many-to-many across different eomodels. This must be done very carefully, so I have copied the relationship properties (e.g., Propagates Primary Key, Optionality, Delete Rule) for each relationship among the three entities from a many-to-many created by EOModeler. However, I have omitted the flattened relationships because joins across databases aren't always supported. Instead, I have made the relationships underlying the flattened relationships class properties if, and only if, I need to traverse the relationship in my app.


Then in my app, instead of being able to use the usual flattened relationships, I now must traverse the underlying relationships that involve the join entity. So if you have a many-to-many relationship between Foo and Bar with FooBar being the join entity and you want to access all Bar objects related to a Foo object that you have already fetched, you can iterate through the foo.fooBars() array getting each Bar object, fooBar.bar(). You can frequently avoid a series of individual DB accesses by setting the Batch Faulting Batch Size property of involved to-many relationships (e.g., Foo.fooBar) to something like 100 which will create a "where" clause with up to 100 OR'ed subclauses.

The goal in writing Java code is to avoid anything that will result in SQL being generated that is a join between 2 tables in different databases.

Art
http://homepage.mac.com/aisbell/
_______________________________________________
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.

References: 
 >Many problems for Many To Many Relationships across Databases (From: "Riaz Lalehzari" <email@hidden>)

  • Prev by Date: Many problems for Many To Many Relationships across Databases
  • Next by Date: Are application variables shared between instances?
  • Previous by thread: Many problems for Many To Many Relationships across Databases
  • Next by thread: Are application variables shared between instances?
  • Index(es):
    • Date
    • Thread