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: Thu, 25 May 2006 10:53:53 +0100
I'm in the middle of moving from the UK to the US and I just
transitioned my development environment from my PowerMac to my iBook
and things seem to have magically started working. Somewhat. I tried
setting simple text values on a couple attributes on both the server-
side and client-side classes. It works just fine on the client side,
but not at all on the server side. It appears that the server-side
code is never being called.
When I try to use a fetch specification to retrieve the object that I
want to setup the relationship to, I get:
Exception in thread "AWT-EventQueue-0"
java.lang.IllegalArgumentException: Array is empty
at com.webobjects.foundation.NSArray.objectAtIndex(NSArray.java:510)
at com.bestmaid.erp.client.Bill_Of_Material.awakeFromInsertion
(Bill_Of_Material.java:25)
The line it is complaining about is designated below:
public void awakeFromInsertion (EOEditingContext ec) {
super.awakeFromInsertion(ec);
EOFetchSpecification fs =
EOFetchSpecification.fetchSpecificationNamed("BillOfMaterial",
"RoutingType");
NSArray routingType = (NSArray)ec.objectsWithFetchSpecification(fs);
---> System.out.println(routingType.objectAtIndex(0).toString());
//setRoutingType((EOGenericRecord)routingType.objectAtIndex(0));
if (routingDescription() == null) {
setRoutingDescription("Routing Description");
}
}
The setRoutingDescription("Routing Description") works exactly as the
documentation describes.
Is there some problem with the way I'm building the NSArray? I'm
really only expecting one value, not an array, but I can't see how to
just get one record.
When I use DBEdit to execute the fetch specification, it returns the
record from the DB that I'd expect. I'm not sure why my Java Code won't.
Thanks!
Dave
On May 19, 2006, at 4:11 PM, Chuck Hill wrote:
According to the WebObjects Java Client Programming Guide (http://
developer.apple.com/documentation/WebObjects/DesktopApplications/
WODesktopApps.pdf), Chapter 6, the section on specifying initial
values (page 123) if you add setters in the awakeFromInsertion()
method, these values will show up immediately.
...
Build and run the application and create a new student record.
You’ll notice that some of the fields are populated in the new
record as shown in Figure 6-11.
Have you tried this example? Does it work?
_______________________________________________
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