• 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: Saving entities problem [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving entities problem [SOLVED]


  • Subject: Re: Saving entities problem [SOLVED]
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 05 Aug 2003 13:43:35 -0700

See bottom of
http://developer.apple.com/documentation/WebObjects/UsingEOModeler/5WorkingW
ithRelationships/chapter_5_section_2.html

If you are using Propagate Primary Key you might want to try it without
that.  I don't always use this for relations into M-M join tables.  To be
honest, I don't recall why.  It may have been because of this problem.  In
any case it just seems to work when using
addObjectToBothSidesOfRelationshipWithKey and flattened relationships.


Chuck


At 09:07 AM 05/08/2003 -0600, Jevon Hills wrote:
>
>Ok  I did as you instructed below.  I believe that I have followed your
>instructions to the letter, I'm still getting an exception when I try
>to save my changes.
>
>I create a new user.
>
>I save my new user.
>
>No problem.  This user is inserted into the database.
>
>I fetch the users from the database and do the following:
>
>	aUsers.addObjectToBothSidesOfRelationshipWithKey(mlp,
>"FLT_APPLICATIONS");
>	 aUsers.addObjectToBothSidesOfRelationshipWithKey(canUse,
>"FLT_PERMISSION");
>
>I then try to save the editing context and get the following stack
>trace.
>2003-08-01 16:49:44 MDT] <WorkerThread0> Cannot save add AppUserPerm
>changes  -
>[2003-08-01 16:49:44 MDT] <WorkerThread0> Attempt to insert null key
>into a com.webobjects.foundation.NSMutableDictionary.
>java.lang.IllegalArgumentException: Attempt to insert null key into a
>com.webobjects.foundation.NSMutableDictionary.
>	at
>com.webobjects.foundation.NSMutableDictionary.setObjectForKey(NSMutableD
>ictionary.java:191)
>	at
>com.webobjects.eoaccess.EODatabaseContext.recordDatabaseOperation(EOData
>baseContext.java:4753)
etc.
>
>Thank you so much for your assistance and patience with this.  It feels
>like I'm on the edge of a break through, or maybe a breakdown either
>way.  It's a long weekend here and I'm taking a break and gonna hit
>this hard on Tuesday..
>
>Thanx for everyones help and if you have any suggestions regarding the
>stack trace I would love hear from you.
>
>> 	One way to create the correct many-to-many relationship in EOModeler
>> would be to have it create a many-to-many relationship between User and
>> Application.  Then you'd need to enhance the resulting join entity by
>> adding another primary key which is the foreign key for the to-one
>> "permission" relationship.  Then you'd add a to-many relationship from
>> Permission to the join entity whose name should be changed to reflect
>> its 3-entity join.    Flatten the relationships from Permission to both
>> User and Application.  Then you'd carefully set the properties of the 2
>> new relationships you just created to be identical to those created by
>> EOModeler when it created a many-to-many relationship between User and
>> Application.
>>
>> 	Then you can decide whether you will really use all the the
>> relationships between these 4 entities.  In relationship sets, if
>> relationships in both directions are class properties, EOF will usually
>> fetch more than is necessary to keep the object graph consistent if you
>> won't be traversing the object graph in both directions.  I try to make
>> a relationship in only one direction a class property to minimize
>> unnecessary and performance-robbing fetches.  This applies to all
>> relationships, not just many-to-many.
>>
>> 	Finally, you'd create a real table in your DB that corresponds to the
>> join entity using the SQL that EOModeler generates.  Or maybe you'd
>> modify the existing DB join table to reflect the entity ensuring that
>> the appropriate indexes, constraints, etc. in EOModeler's generated SQL
>> exist in the DB.
>>
>> Aloha,
>> Art
>_______________________________________________
>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.
>

--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
_______________________________________________
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.

  • Follow-Ups:
    • Re: Saving entities problem [SOLVED] {DONE -- FOR NOW}
      • From: Jevon Hills <email@hidden>
References: 
 >Re: Saving entities problem [SOLVED] (From: Jevon Hills <email@hidden>)

  • Prev by Date: Re: Relationships with horizontally mapped inheritance
  • Next by Date: Re: Xcode
  • Previous by thread: Re: Saving entities problem [SOLVED]
  • Next by thread: Re: Saving entities problem [SOLVED] {DONE -- FOR NOW}
  • Index(es):
    • Date
    • Thread