Re: Can't insert eos on 5.1 win2k

"Eric Bergerson" <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
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
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.