• 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: EO: Not propagating key values...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EO: Not propagating key values...


  • Subject: Re: EO: Not propagating key values...
  • From: email@hidden (Anjo Krank)
  • Date: Mon, 4 Aug 2003 11:18:34 +0200
  • Xx-reply-to: email@hidden

Am Montag, 04.08.03, um 10:40 Uhr (Europe/Berlin) schrieb Art Isbell:
Meaning, if I just create an object with my properties will
EO create the key?

No. You will need to create the primary and foreign keys in EOModeler, but EOF will populate these keys in the DB automatically so you will never need to access them in your Java code

This is only true when you either have PKs which are numerical or char(40?) with data type of NSData, or the PK consists in whole of propagated PKs of foreign entities.


In all other cases you have to create the PK values yourself and this is not exactly trivial or easy to find. You have to implement a method

public NSDictionary databaseContextNewPrimaryKey(EODatabaseContext databaseContext, Object object, EOEntity entity);

on some class (probably Application.java) and set an object of this class as the default delegate via:

    EODatabaseContext.setDefaultDelegate(this);

before creating the first object (probably in the apps constructor). Typically, you will have your PK marked as a class property, would retrive the value from there and construct a dictionary from that.

Cheers, Anjo
_______________________________________________
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: 
 >Re: EO: Not propagating key values... (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: EO: Not propagating key values...
  • Next by Date: Re: EO: Not propagating key values...
  • Previous by thread: Re: EO: Not propagating key values...
  • Next by thread: Re: EO: Not propagating key values...
  • Index(es):
    • Date
    • Thread