• 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: I dont get it, still nullpointer exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I dont get it, still nullpointer exception


  • Subject: Re: I dont get it, still nullpointer exception
  • From: "Cheong Hee (Datasonic)" <email@hidden>
  • Date: Thu, 16 Oct 2008 12:52:10 +0800

Hi

Not sure if I got it right. I presumed if this is a many-to-many modelling between Employee and Turn, and the relationship is flattened.

The way I think it should do to add Employee to Turn and Turn to Employee are as the following:
localEmployee.addToTurns(actualTurn);
actualTurn.addToEmployees(localEmployee);


Then call your save changes. Usually there is no need to addBothSideRelationshipWithKey to join table e.g. EmployeeXTurn (presumed again this is join table).

The other thing thought may be useful to check is "propogate primary key" is ticked between the Employee and its relationship to join table, vice versa between Turn and its relationship to join table.

HTH

Cheong Hee

------------------------------

Message: 6
Date: Wed, 15 Oct 2008 23:11:16 -0500
From: WebObjects <email@hidden>
Subject: I dont get it, still nullpointer exception
To: WebObjects-Dev Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"

Hello, I fixed (or thought I did) the EOmodel, then I did this in my
method.
Employee localEmployee =
(Employee)EOUtilities.localInstanceOfObject(myEC, emp);
System.out.println(selectedItems());


NSArray<Turn> localSelectedItems = EOUtilities.localInstancesOfObjects(myEC, selectedItems()); EmployeeXTurn empxTurn = (EmployeeXTurn) ERXEOControlUtilities.createAndInsertObject(myEC,"EmployeeXTurn"); for (Turn actualTurn:localSelectedItems){ actualTurn.addToEmployeeXTurn(empxTurn); } System.out.println(localSelectedItems);

empxTurn.addObjectToBothSidesOfRelationshipWithKey(localEmployee,
EmployeeXTurn.EMPLOYEE_KEY);
inside the for I have tried the
addObjectToBothSidesOfRelationshipWithKey() method and the
addObjectsToBothSidesOfRelationshipWithKey() method and im still
getting this error

java.lang.NullPointerException
at
com
.webobjects
.eoaccess
.EODatabaseContext
._objectFaultWithSnapshotRelationshipEditingContext
(EODatabaseContext.java:2356)
at
com
.webobjects
.eoaccess
.EODatabaseContext
._fireDeferredFaultWithSourceObject(EODatabaseContext.java:2401)
at
com
.webobjects
.eoaccess
.EOAccessDeferredFaultHandler
.createFaultForDeferredFault(EOAccessDeferredFaultHandler.java:49)
at
com
.webobjects
.eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java:1279)
at
er
.extensions
.eof.ERXGenericRecord.willReadRelationship(ERXGenericRecord.java:348)
at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer
$
_LazyGenericRecordBinding
.valueInObject(_EOMutableKnownKeyDictionary.java:614)
at
com
.webobjects
.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1634)
at
com
.webobjects
.eoaccess
.EODatabaseContext.databaseOperationForObject(EODatabaseContext.java:
4814)
at
com
.webobjects
.eoaccess.EODatabaseContext.valuesForKeys(EODatabaseContext.java:6535)
at
com
.webobjects
.eocontrol
.EOObjectStoreCoordinator.valuesForKeys(EOObjectStoreCoordinator.java:
326)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
_KeyValueQualifierSupport
.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:439)
at er.extensions.ERXExtensions
$
KeyValueQualifierSQLGenerationSupport
.schemaBasedQualifierWithRootEntity(ERXExtensions.java:304)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
Support
._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
at
com
.webobjects
.eoaccess
.EODatabaseChannel
.selectObjectsWithFetchSpecification(EODatabaseChannel.java:227)
at
com
.webobjects
.eoaccess
.EODatabaseContext
._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:
3055)
at
com
.webobjects
.eoaccess
.EODatabaseContext
.objectsWithFetchSpecification(EODatabaseContext.java:3195)
if I just do this :
empxTurn.addObjectToBothSidesOfRelationshipWithKey(localEmployee,
EmployeeXTurn.EMPLOYEE_KEY);

or this :
localEmployee.addObjectToBothSidesOfRelationshipWithKey(empxTurn,
Employee.EMPLOYEE_X_TURNS_KEY);
all its fine, I can add the employee to the EmployeeXTurn, btu the
problem comes when adding the turn to the EmployeeXTurn.
I think you guys are getting tired of this problems Im having, also I
am, can get it why Im having them.

any clues?

Gus








-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/pipermail/webobjects-dev/attachments/20081015/0c2118ed/attachment.html


------------------------------

_______________________________________________
Webobjects-dev mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/webobjects-dev

End of Webobjects-dev Digest, Vol 5, Issue 1007
***********************************************



_______________________________________________
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


  • Prev by Date: I dont get it, still nullpointer exception
  • Next by Date: Re: modify the db from EOModel without risking the data
  • Previous by thread: I dont get it, still nullpointer exception
  • Next by thread: NSTimestamp.timestampByAddingGregorianUnits considered harmful
  • Index(es):
    • Date
    • Thread