Re: Setting a Default toOne Relationship
Re: Setting a Default toOne Relationship
- Subject: Re: Setting a Default toOne Relationship
- From: David Avendasora <email@hidden>
- Date: Fri, 19 May 2006 10:25:35 +0100
On May 19, 2006, at 9:45 AM, Paul Lynch wrote:
On 19 May 2006, at 09:35, David Avendasora wrote:
I've been following the instructions in the WebObjects Java Client
Programming manual (http://developer.apple.com/documentation/
WebObjects/DesktopApplications/WODesktopApps.pdf) for "Enhancing
the Application" in which it describes several ways to modify a
Direct To Java Client application. In the instructions for setting
initial values (page 123), the example code is put in the
awakeFromInsertion(EOEditingContext) method in the server-side
class. I was putting it in the client-side, but I've now generated
server side classes, added it to the Application Server target and
put the code there and even changed it to simply put a default
value in one of the attributes instead of setting a relationship,
but it still doesn't work.
My understanding is that it belongs in the server side class, not
the client side. You should also really be developing server side
classes in general before client side, as that is where most of the
logic belongs.
As I stated above, it is now in the server side, AND I simplified it
to match the documentation's example. Still, it doesn't work.
Here's what my code now looks like
public void awakeFromInsertion (EOEditingContext ec) {
super.awakeFromInsertion(ec);
System.out.println("Routing awakeFromInsert Called");
if (routingDescription() == null) {
setRoutingDescription("Description");
}
}
When I click the new icon for a routing and I get the form window,
the default is not set and nothing shows in the console.
This won't be called until it is inserted in the editing context;
have you checked this already?
This is probably the crux of my problem. What you see above is the
entire extent of the custom code written for the application so far.
This is IT. NOTHING else. Everything else is managed by WO's D2JC
framework. How would I check to see if it's been inserted?
In all the "Enhancing the Application" code, I don't ever see an
example of adding the instance to the editing context. I'm assuming
that since I get a Form Window with fields that I can fill in and
drop-downs I can choose from, etc that the instance has been inserted
into an editing context by WO without any additional work by me.
It appears that the awakeFromInsertion() method isn't even being
invoked. But since I'm simply making a modification to a D2JC
application, I don't know everything that is going on behind the
scenes to trigger a new instance and therefor what might be going
wrong prior to this point.
You are creating a new instance of the class and inserting it in
the editing context (there's a couple of different ways of doing
this in code).
Is your log message producing any output?
No, nothing in the console.
Paul
_______________________________________________
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