Re: JavaFSAdaptor and non-working EO methods
Re: JavaFSAdaptor and non-working EO methods
- Subject: Re: JavaFSAdaptor and non-working EO methods
- From: Joe Little <email@hidden>
- Date: Thu, 21 May 2009 10:03:01 -0700
On Wed, May 20, 2009 at 1:23 PM, Chuck Hill <email@hidden> wrote:
> Sounds like EOF is confused as to which entity/class it has. Duplicated
> primary keys perhaps? Try adding some logging as below.
>
I also had it list the output at the end of each saveChanges() as well
as right before the second saveChange (test 2). Test 3 never runs
because of the aforementioned error. Your answer though is this:
myFile class your.app.eo.FSFile
test 1: test text
myFile class your.app.eo.FSFile
test 2: test text
Same class.
>
> On May 20, 2009, at 12:57 PM, Joe Little wrote:
>
>> On Wed, May 20, 2009 at 11:32 AM, Joe Little <email@hidden> wrote:
>>>
>>> On Wed, May 20, 2009 at 11:26 AM, Anjo Krank <email@hidden> wrote:
>>>>>
>>>>> One can create files or directories, but
>>>>> there is no way to save data to those files. Yikes.
>>>>
>>>> It's been ages (6years+) since I tried to create a simple D2W app from
>>>> that
>>>> code, but AFAIR, I had no trouble writing to a file. The only downside
>>>> then
>>>> was that you don't have working rollback.
>>>>
>>>> Cheers, Anjo
>>>
>>> I presume the answer is not via the EO (all methods are read-only) as
>>> Chuck suggests, but rather referencing the URL and then using java
>>> file I/O methods to push data directly. Again, at least in its present
>>> state the model is all read-only and other than that, I'm unsure of
>>> what automagically is supported as an EO.
>>
>> Well, further mucking hasn't helped. By way of example:
>>
>> FSFile myFile;
>>
>> EOEditingContext ec = session().defaultEditingContext();
>> myFile = (FSFile) EOUtilities.createAndInsertInstance (ec, "FSFile");
>
> NSLog.out.appendln("myFile class " + myFile.getClass().getName());
>
>
>> myFile.takeValueForKey ("/tmp/mytest", "absolutePath");
>>
>>
>> myFile.setContent("test text");
>> ec.saveChanges();
>>
>> on saveChanges, nothing is actually written to disk but the entity
>> does reflect content="test text". I then have this in the code:
>>
>> myFile = null;
>>
>> EOQualifier myQual = new EOKeyValueQualifier ("absolutePath",
>> EOQualifier.QualifierOperatorEqual, "/tmp/mytest");
>> EOFetchSpecification myFS = new EOFetchSpecification ("FSFile", myQual,
>> null);
>> NSArray myObjects = ec.objectsWithFetchSpecification(myFS);
>> if (myObjects.count() == 0)
>> return "No file present called /tmp/mytest";
>> else
>> {
>> myFile = (FSFile) myObjects.objectAtIndex(0);
>
> NSLog.out.appendln("myFile class " + myFile.getClass().getName());
>
>
>>
>> myFile.setContent("test text2");
>> ec.saveChanges();
>> return myFile.name() + ": " + myFile.content();
>> }
>>
>> At this point, saveChanges() complains that setContent doesn't exist.
>>
>> <WorkerThread0>
>> <com.webobjects.appserver._private.WOComponentRequestHandler>:
>> Exception occurred while handling request:
>> com.webobjects.eoaccess.EOGeneralAdaptorException: <java.io.File
>> 0x125f92> takeValueForKey(): attempt to assign value to unknown key:
>> 'content'.
>> This class does not have an instance variable of the name content or
>> _content, nor a method of the name setContent or _setContent
>>
>>>
>>>
>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>
>> _______________________________________________
>> 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
>>
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Come to WOWODC'09 in San Fran this June!
> http://www.wocommunity.org/wowodc09/
>
>
_______________________________________________
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