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: Wed, 20 May 2009 11:16:34 -0700
Ah. something else is amiss. As soon as I commented out my code to
write to the file, the reading of the file and the various name/path
attributes worked. I did set "myFile = null" before I performed the
new fetch of objects and assigned the first array element to myFile,
it should have worked as written.
More troublesome is the fact that the setContent as now bearings on
the insert. Perhaps one needs to save changes first (storing the
initial object) before setContent can effectively be used..
Let's try that:
myFile = (FSFile) myObjects.objectAtIndex(0); // confirmed that I had
the right file from my qual
myFile.setContent("A different piece of text");
ec.saveChanges();
And with that my ec.saveChanges() instead of doing nothing now barfs
about a URL not being correct.
2009-5-20 11:16:7 PDT] <WorkerThread0>
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
java.lang.ClassCastException: java.net.URL
[2009-5-20 11:16:7 PDT] <WorkerThread0> java.lang.ClassCastException:
java.net.URL
at your.app.eo._FSItem.url(_FSItem.java:175)
On Wed, May 20, 2009 at 11:06 AM, Joe Little <email@hidden> wrote:
> I got the JavaFSAdaptor up and running, created a model, eogenerated,
> and was able to create a file just fine. However, let's look at an
> example that fails. I'm trying to set the content, which apparently
> can only be a string:
>
> EOClassDescription aClassDescription =
> EOClassDescription.classDescriptionForEntityName("FSFile");
> EOEditingContext ec = session().defaultEditingContext();
>
> FSFile myFile = (FSFile)
> aClassDescription.createInstanceWithEditingContext(ec, null);
> myFile.takeValueForKey ("/tmp/mytest", "absolutePath");
> ec.insertObject(myFile);
> myFile.setContent("Good Test!");
> ec.saveChanges();
>
>
> Now, later when I reference that file from a fresh fetch, I do get
> "Good Test!" when viewing the content. However, the file itself is
> empty on the filesystem. Perhaps content isn't what I think it is.
> Well, FSFile.name() is a method to get the filename for the given
> file. Referencing that always returns null. So does FSfile.path().
> Something is seriously not going as expected with this adaptor and/or
> I'm missing some basic understanding of what the EO purports to
> support.
>
_______________________________________________
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