Re: refresh an enterprise object
Re: refresh an enterprise object
- Subject: Re: refresh an enterprise object
- From: Nathan Dumar <email@hidden>
- Date: Mon, 21 Jun 2004 19:07:17 -0400
If the relationship is set up correctly, you should be doing something
like:
// assuming a to-1
aProduct.setStatus(aStatusObject);
and if it's reciprocal,
// assuming a to-many
aStatusObject.setProducts(aStatusObject.products().arrayByAddingObject(a
Product));
You shouldn't be setting the key yourself. Let WO figure that stuff
out -- just tell it which objects are related.
You won't be able to traverse a relationship that you have not yet
defined. User EOModeler first to set everything up. After that, the
Java will work.
Nathan
On Jun 21, 2004, at 10:09 AM, Goh Keng Boon wrote:
if I do a aProduct.setStatus(new Double(1)) and ec.saveChanges(), the
"1" can be saved into my database, however when i want to travel
through the relationship, i got difficulty, as it is not defined.
For example : aProduct.ps().statusdisplay()
This happened because i'm not using
"addObjectToBothSidesOfRelationshipWithKey", although data is inserted
but the relationship
is not "declared" at this time. How can i refresh my aProduct (without
a fetch spec) so that I can travel through the relationship?
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.