Imagine the following model, where a User has a many to many relationship with Message. A user can have many messages and messages can be read by many users.

User <<----------->> Message

I can model this in EOModeler as a flattened relationship, and as expected this will create the many-to-many indirection table UserMessage for me.

User <------>> UserMessage <<----> Message

In the User entity it creates a relationship property messages() that allows me to bypass the indirection table (and users() in Messages).

Now for the questions:

1 ==
In the "deprecated" EOModeler User Guide it states:
" Primary key propagation is also commonly used to generate primary keys for join tables in many-to-many relationships."

If the join table has a compound primary key (consisting of the two foreign keys to User and Message), how does this apply?

2 ==
Does anybody know how does WebObjects manage flattened relationships internally? Basically I want to know if (besides having more readable code) I get some performance improvements using this.
So which are there any performance differences in these two?

user.messages();
or
user.userMessages().valueForKey("message");


3 ==
Now imagine I need to know if a user has read a message. I would simply add a boolean to the indirection table to store this. Can I still use the flattened relationships WebObjects provides and store this boolean in the indirection table?
Are there any caveats I should be aware of?

4 ==

Theoretically if a message has no relation to users, it should be deleted.
Does Owns Destination work in this many-to-many scenario?

5 ==

Not directly related to this scenario but I still couldn't quite figure out:

When doing a addObjectToBothSideOfRelationship how does EOF know which relationship is the inverse relationship?
In Core Data this is explicitly set but not in EOF.



Sorry if this was a bit too long, but I'm trying to tie up loose ends in my mental model of EOF.

Thank you for your time,
Paulo F. Andrade






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

This email sent to [email protected]

Reply via email to