• 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
Problem in Many-Many Relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem in Many-Many Relationship


  • Subject: Problem in Many-Many Relationship
  • From: Meena Srinivasan <email@hidden>
  • Date: Tue, 8 Apr 2003 11:32:43 +0200

Hello all,

I have two tables, "Role" and "Users"  which has a many-to-many
relationship, thus resulting in "UserRole".   That is, "UserRole" just
has the primary key of "Role" and the primary key of "Users" and there
are no other attributes in "UserRole".

"Role" has an instance "currentRole" and "Users" has an instance
"selectedUser".  Therefore, on save,  I use the following piece of code
to insert the record in "UserRole"

   currentRole.addToToUsers(selectedUser);
   this.session().defaultEditingContext().saveChanges();

Basically, the saveChanges inserts the record into the database, but
the application doesn't recognise this and results in the following
error

NOTE:  The code is working fine with WebObjects4.5, but not with
WebObjects 5.1.4

***************************************************************
Cannot save changes
[2003-04-08 11:24:41 CEST] <WorkerThread2> <WOApplication 'LAWeb'>:
Exception occurred while handling request:
java.lang.NullPointerException
[2003-04-08 11:24:41 CEST] <WorkerThread2>
java.lang.NullPointerException
	at
com.webobjects.eocontrol.EOKeyValueCoding$DefaultImplementation._storedK
eySetBindingForKey(EOKeyValueCoding.java:198)
	at
com.webobjects.eocontrol.EOKeyValueCoding$DefaultImplementation.takeStor
edValueForKey(EOKeyValueCoding.java:180)
	at
com.webobjects.eocontrol.EOKeyValueCodingAdditions$DefaultImplementation
._takeStoredValuesFromDictionary(EOKeyValueCodingAdditions.java:166)
	at
com.webobjects.eoaccess.EODatabaseContext.commitChanges(EODatabaseContex
t.java:6306)
	at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingCo
ntext(EOObjectStoreCoordinator.java:406)
	at
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.j
ava:2498)
	at SecurityList.saveUserRole(SecurityList.java:313)
	at java.lang.reflect.Method.invoke(Native Method)
	at
KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAcces
sor.java:24)
	at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(
NSKeyValueCoding.java:1122)
	at
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueFo
rKey(NSKeyValueCoding.java:1223)
	at
com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1465)
	at
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValu
eCoding.java:448)

***************************************************************

Thanks for any help,
Meena.
_______________________________________________
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: Problem in Many-Many Relationship
      • From: Art Isbell <email@hidden>
    • Re: Problem in Many-Many Relationship
      • From: mmalcolm crawford <email@hidden>
    • Re: Problem in Many-Many Relationship
      • From: Radwar <email@hidden>
  • Prev by Date: Re: action binding with conditionals
  • Next by Date: Re: action binding with conditionals
  • Previous by thread: Re: Help with subclassing a EOQueryController!
  • Next by thread: Re: Problem in Many-Many Relationship
  • Index(es):
    • Date
    • Thread