• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: adding multiple objects in a relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding multiple objects in a relationship


  • Subject: Re: adding multiple objects in a relationship
  • From: Johann Werner <email@hidden>
  • Date: Sat, 18 Oct 2008 08:30:42 +0200

Hi Gus,

does EmployeeTurn represent your join table? If not look at Lachlans suggestion, if you answer this question with yes you will need an EmployeeTurn object for each combination of Employee and Turn.
This would mean that you have to change your code:


Am 18.10.2008 um 03:00 schrieb WebObjects:

Hello, well after so much struggle, finally I have my app up and running, but there is a problem.

for the people who knows what's my app all about, you will know that an Employee can have multiple Turn, now, Im doing the following:
NSArray<Turn> localSelectedItems = EOUtilities.localInstancesOfObjects(myEC, selectedItems());

for (Turn turn : localSelectedItems) {

EmployeeTurn empxTurn = (EmployeeTurn) ERXEOControlUtilities.createAndInsertObject(myEC,"EmployeeTurn");


empxTurn.addObjectToBothSidesOfRelationshipWithKey(localEmployee, EmployeeTurn.EMPLOYEE_KEY);

empxTurn.addObjectsToBothSidesOfRelationshipWithKey(turn, EmployeeTurn.TURN_KEY);
}



System.out.println(localSelectedItems);

	System.out.println("Did it!!");	

		myEC.saveChanges();

I select in the component the turns I want, I fetch them I display them I select them. so far so good.

It does all the process but when i go and see the db to see what is inside I realize that the join table, called here empxTurn, has only the last object of the NSArray localSelectedItems.

I tried doing this inside a for() clause and it has the same behavior.

what am I doing wrong.??/


Gus

PS Im happy there is no more migration problem!!! and no more NullPointerException using the AddObjecttoBothsidesOfRelatioship method.


_______________________________________________ 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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: adding multiple objects in a relationship
      • From: Lachlan Deck <email@hidden>
References: 
 >adding multiple objects in a relationship (From: WebObjects <email@hidden>)

  • Prev by Date: Re: adding multiple objects in a relationship
  • Next by Date: Re: adding multiple objects in a relationship
  • Previous by thread: Re: adding multiple objects in a relationship
  • Next by thread: Re: adding multiple objects in a relationship
  • Index(es):
    • Date
    • Thread