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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to