Re: Can't insert eos on 5.1 win2k

Hordur Thordarson <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
I know I know ;-)

I was using EOUtilities.createAndInsertInstance() in at least one of 
the 10 previous version of this function and that didn't work either.  
I'll try one of the diet versions suggested here tomorrow, but I'm 
starting to suspect that there is smth wrong with the wo installation 
or frontbase installation or smth (allthough the wo app compiles and 
runs just fine, it just won't insert my record into the database).

In any case the exception is occurring on the .saveChanges() call.

Thanks !

Hordur

On Mánudagur, sep 30, 2002, at 21:31 Atlantic/Reykjavik, Eric Bergerson 
wrote:

> Chuck is correct, don't change the values of the eo before it is in the
> EditingContext, and will change is done for you.
>
> The easiest way to create a new eo and insert it in the editing context
> is:
>
> EOUtilities.createAndInsertInstance(EOEditingContext ec, String
> entityName);
>
>> I don't know about your exact error but calling willChange() seems
> very
>> unnecessary and you should insert the EO into an EC before doing
> anything else.
>>   Try this:
>>
>>       try {
>>           logRec = new DeployLogEO();
>>           this.session().defaultEditingContext().insertObject(logRec);
>>           logRec.takeValueForKey(curDate, "logdatetime");
>>           this.session().defaultEditingContext().saveChanges();
>>       }
>>
>>
>> Chuck
>>
>>
>> Hordur Thordarson wrote:
>>
>>> Hi all,
>>>
>>> I'm getting the following error when trying to insert an eo in a
> new wo
>>> 5.1 project on win2k:
>>>
>>> com.webobjects.foundation.NSForwardException
>>> [java.lang.IllegalAccessError] try to access field
>>> com.webobjects.eocontrol.EOSharedEditingContext._sharedLock from
> class
>>> com.webobjects.eoaccess._EOGlobalObjectStoreLock
>>>
>>> The code that causes the error is:
>>>
>>> public WOActionResults defaultAction() {
>>>
>>>     DeployLogEO logRec;
>>>     NSTimestamp curDate = new NSTimestamp();
>>>
>>>     try {
>>>         logRec = new DeployLogEO();
>>>         logRec.willChange();
>>>         logRec.takeValueForKey(curDate, "logdatetime");
>>>         this.session().defaultEditingContext().insertObject(logRec);
>>>         this.session().defaultEditingContext().saveChanges();
>>>     }
>>>     catch (Exception e) {
>>>         System.out.println(e.toString());
>>>     }
>>> }
>>>
>>> I just put this into a new project with a new eomodel and
> everything
>>> (was happening in a project converted from 4.5 to 5.1) but no
> luck.  Is
>>> my installation messed up or smth ?  There are 2 other reports of
> this
>>> bug on the wodev list but neither seems to have been answered (last
> one
>>> was today or yesterday).
>>>
>>> All hints and suggestions appreciated.
>>>
>>> Thanks,
>>>
>>> Hordur Thordarson
>>> Smartkort hf.
>>>
>>> _______________________________________________
>>> EOF mailing list
>>> [email protected]
>>> http://www.omnigroup.com/mailman/listinfo/eof
>>
>>
>> -- 
>>
>> Chuck Hill                                 [email protected]
>> Global Village Consulting Inc.             http://www.global-
> village.net
>>
>>
>>
>> _______________________________________________
>> EOF mailing list
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/eof
>>
>>
>
> Sincerely,
>
> Eric Bergerson
> Contact Info: http://www.ukibi.com/eb
> _______________________________________________
> EOF mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/eof
>
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.