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
|