• 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: using primary and foreign keys as class properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using primary and foreign keys as class properties


  • Subject: Re: using primary and foreign keys as class properties
  • From: Zak Burke <email@hidden>
  • Date: Mon, 05 Feb 2007 10:32:28 -0500

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >using primary and foreign keys as class properties (From: Steven Mark McCraw <email@hidden>)

  • Prev by Date: Re: using primary and foreign keys as class properties
  • Next by Date: Java Monitor restarts hang my app?
  • Previous by thread: Re: using primary and foreign keys as class properties
  • Next by thread: Java Monitor restarts hang my app?
  • Index(es):
    • Date
    • Thread