On Mar 11, 2009, at 1:20 PM, Chuck Hill wrote:


On Mar 11, 2009, at 9:46 AM, David Avendasora wrote:

Hi all,

I've run into something that I haven't been able to find documented anywhere, but does seem to fit with other Cross-Model relationship issues (http://lists.apple.com/archives/Webobjects-dev/2008/Dec/msg00058.html ).

If you have a cross-model relationship,

Same database or different database?

It is a different database. It happens to reside on the same DB server, but there's no guarantee that that will be the case long term.

you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship.

I think that would be a bug. Prefetching is a separate select so it should not matter if it is in a different database.

I thought it would do a separate select, but using a join to get only the related EOs. Otherwise how would it know which records to select? If it is a cross-DB join, then EOF (or the DB plugin - MSSQL in this case) would need to add the Server and Database name to the table names in the SQL such as:

SELECT T2.column1, T2.column2, T3.etc FROM Server1.WO.dbo.table T1, Server2.GP.dbo.table1 T2 WHERE T1.pkColumn = T2.fkColumn

Subsequent calls to the relationship simply return null or the empty NSArray.

Which is clearly a bug if they return proper results normally.

Yep. I took out the prefetch path for the cross-model relationship and now when relationship() is called on one of the fetched EOs a round- trip to the database is done and I get exactly what I would expect.

Is this the expected behavior?

No to me.

Am I the first to ever prefetch a cross-model relationship?! I would think that those would be prime candidates for prefetching, especially if it is a different DB server.

Or is this a case of the Microsoft DB plugin just not handling the relationship properly?

Dave
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to