Sounds like EOF is confused as to which entity/class it has. Duplicated primary keys perhaps? Try adding some logging as below.

On May 20, 2009, at 12:57 PM, Joe Little wrote:

On Wed, May 20, 2009 at 11:32 AM, Joe Little <[email protected]> wrote:
On Wed, May 20, 2009 at 11:26 AM, Anjo Krank <[email protected]> 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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jmlittle%40gmail.com

This email sent to [email protected]


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [email protected]


--
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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to