• 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: permanentGlobalID not permanent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: permanentGlobalID not permanent


  • Subject: Re: permanentGlobalID not permanent
  • From: Jean-François Veillette <email@hidden>
  • Date: Thu, 08 May 2014 12:40:53 -0400

On first sight, it doesn't seem like I set another delegate.
I'll take time to investigate it further in the next few days.

Thanks!

Le 2014-05-08 à 11:06, Ralf Schuchardt <email@hidden> a écrit :

Am 08.05.2014 um 05:36 schrieb Jean-François Veillette <email@hidden>:

PrimaryKey obtained by permanentGlobalID() are not saved as the primaryKey on saveChanges().

I'm setting a global id as a reference for « soft relationship » (since it point to undefined object) instead of a « hard relationship » (usual when we store the pk).

The problem is that I get 2 primary key (yes 2 sequences number out of the database):
- the first come from the call to permanentGlobalID(), wich return 7985.
- the next come from the save of the object itself, it ask again for a sequence.
Result: the first reference is actually not pointing to the saved object!


Here is the code for the setter:

public void setReference(final ERXGenericRecord ref) {
EOKeyGlobalID pgid = ref.permanentGlobalID();
setReferenceGlobalID(ERXKeyGlobalID.globalIDForGID(pgid));
// added log to debug ...
final EOGlobalID gid = editingContext().globalIDForObject(ref);
log.debug("GlobalID: " + gid + "    permanent: " + pgid);
}

give: 
GlobalID: <EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 -5 -116 1 0 0 0 1 69 -39 18 -94 -76 -125 18 82 -3>    permanent: _EOIntegralKeyGlobalID[AGA_Participant (java.lang.Integer)7985]

It's a wonder project, all EOs (ultimately) inherit from ERXGenericRecord.
I'm using ERXEC default factory to get editingContext.

From the documentation it says it is supposed to work, so I guess I have something misconfigured.

Do you have a special delegate set in your EODatabaseContext? The stored primary key (generated by primaryKeyDictionary called from permanentGlobalID) is used by an ERXDatabaseContextDelegate. ERXExtensions.bundleDidLoad normally sets an instance of this class as delegate.


Ralf


 _______________________________________________
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

  • Follow-Ups:
    • Re: permanentGlobalID not permanent
      • From: Alexis Tual <email@hidden>
References: 
 >permanentGlobalID not permanent (From: Jean-François Veillette <email@hidden>)
 >Re: permanentGlobalID not permanent (From: Ralf Schuchardt <email@hidden>)

  • Prev by Date: Re: ERPDFGeneration problem
  • Next by Date: Re: ERPDFGeneration problem
  • Previous by thread: Re: permanentGlobalID not permanent
  • Next by thread: Re: permanentGlobalID not permanent
  • Index(es):
    • Date
    • Thread