Re: Help inserting many-to-many (more info)

Sarwat Khan <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Well, it works now, but it's giving me a null pointer exception on  
saveChanges.

I say it works because the database looks correct after the operation.  
So the only thing that's odd is the null pointer exception I'm getting.  
I've included an edited stack trace below. Is there a way I can find  
out what key it's dealing with?

java.lang.NullPointerException
<snip> EOKeyValueCoding$DefaultImplementation._storedKeySetBindingForKey
<snip> EOKeyValueCoding$DefaultImplementation.takeStoredValueForKey
<snip>  
EOKeyValueCodingAdditions$DefaultImplementation._takeStoredValuesFromDic 
tionary
<snip> EODatabaseContext.commitChanges
<snip> EOObjectStoreCoordinator.saveChangesInEditingContext
<snip> EOEditingContext.saveChanges

This screws up that context because the next time I use it to save  
changes (I'm using the session's context), it thinks it's already  
saving changes (I get an Illegal State exception).

Does anyone else have problems using OpenBase? I think I have to drop  
it for this project, but really I don't know if it's WebObjects or  
OpenBase that's screwing things up. I get dumb little errors like "This  
entity does not have key title," when clearly it exists in the db and  
in EOModeler. That's happened twice on two different tables.

And relationships seems hopelessly broken. There's the exception I'm  
getting here, and I can't get many-to-one relationships to work at all.  
It won't update the 'many' side. If I do this,

comment.addObjectToBothSidesOfRelationshipWithKey(story, "story");

The story doesn't get the commandId set. If I turn it around and do  
this,

story.addObjectToBothSidesOfRelationshipWithKey(comment, "comments");

I get an exception! It complains that commentId is nil. I think I'm  
going to run some tests with the MySQL adaptor... after installing  
MySQL.

I had things working when I was doing them 'wrong,' when I had primary  
keys as class properties and was setting them directly (like setUserId  
in the code snippet I posted before). But I can't seem to get anything  
functional by doing things as suggested in the documentation.


{sarwat khan : http://sarwat.net}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.