Steven Mark McCraw wrote on 2/3/07 6:36 PM:
I recall reading in some of the early Apple WebObjects documentation that it's a huge terrible thing to mark your foreign and primary keys as class properties (e.g. check the little diamond in EOModeler so that your generated classes give you setters and getters to access them directly).

I'm chiming in rather late here, but there is at least one specific circumstance when exposing FKs will cause tremendous pain:

When an EO has (1) a required relation, (2) the relation's FK is marked as required and (3) the FK is available as a class property, EOF will choke when you try to persist new objects because validation happens before PK generation. That is, if the relationship-owner and the relationship-destination are both new objects, validation of the relationship-owner's FK will fail because the destination object hasn't had its PK generated yet.

An earlier discussion about this problem is here:
http://www.omnigroup.com/mailman/archive/webobjects-dev/2006-December/002760.html

That discussion focuses on model validation with Eclipse/Entity Modeler, bu the issue is the same.

FWIW, I have PKs exposed all over the place in my apps, mainly as hooks for DirectAction pages, and that's never caused me any kind of problem.

Cheers,

zak.
_______________________________________________
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