Re: Many to many relationship... some problem
Re: Many to many relationship... some problem
- Subject: Re: Many to many relationship... some problem
- From: "Ricardo J. Parada" <email@hidden>
- Date: Mon, 10 Aug 2009 17:51:31 -0400
On Aug 10, 2009, at 6:25 AM, Francesco Romano wrote: Ok.. I'm choosing the second method: I'll create setter and getter...But.. two things: what is the difference between the addToOrderRelationship method and addObjectToBothSideOfRelationship ?
The addToOrderRelationship is probably generated by EOGenerator if you are using the wonder templates for your EOs.
Think of it as a convenience method to EOF's addObjectToBothSidesOfRelationship().
Second: These are my methods:
public Ordine ordine() { return super.ordine().get(0); }
public void setOrdine(Ordine ord) { NSArray<Ordine> ordini = super.ordine(); if (ordini.count()>0) this.removeFromOrdineRelationship(ordini.get(0)); this.addToOrdineRelationship(ord);
} }
But.. in the getter I've an error: I'm overriding a "super" method that returns an array... can I change the name to getOrdine or there are some problems??
Are you using the same name for both the to-one and the to-many methods? I think they should be different. In other words your generated _Cart class would have an orders(), addToOrders(), addToOrdersRelationship(), etc.
Then you would add the order() and setOrder() method in Cart.java (the subclass of _Cart) that are simply cover methods to the to-many orders.
At least that's how I understood it.
:-)
|
_______________________________________________
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