• 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: Global ID problem with flattened relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global ID problem with flattened relationship


  • Subject: Re: Global ID problem with flattened relationship
  • From: Ângelo Andrade Cirino <email@hidden>
  • Date: Wed, 21 May 2014 08:52:55 -0300

Hi Markus,

You are right, that's exactly my model. My problem is that I am trying to stick to ERMODEditRelationshipPage to display and edit the ContactMechanism and its sub entities. My approach has been to try to set the ContactMechanism type prior to the display of ERMODEditRelationshipPage, because this way I can choose which attributes will be shown with displayPropertyKeys rules. Also, since ERMODEditRelationshipPage edits the sub entities indirectly, using key paths, ContactMechanism.awakeFromInsertion must have access to the type of sub entity to be created, and the type must be passed by the D2WContext.

Another problem is that if I leave the type of sub entity to be created in edit time, then I will need a way to reload the display properties and labels inside the ERMODEditRelationshipPage component, based on the event of change in the user selection of a pop up. I didn't find a way to accomplish this.

I tried to create a rule to change an attribute in my parent entities, something like

100 : tabKey = 'Email' => object.contactMechanismTypeFlag = "E" [com.webobjects.directtoweb.KeyValueAssignment]

since I am using a tabbed edit page. But this rule dean't work and I don't know if the rules assignment system will be able to set an attribute value in this way. I tried other ways to set rules to pass the information on the kind of sub entity with no success.

If I am able to set the type of the sub entity prior to the display of ERMODEditRelationshipPage I will solve my problem entirely.

Angelo


2014-05-21 5:24 GMT-03:00 Markus Ruggiero <email@hidden>:
Hi, 

I am not really clear about your datamodel - and I think some of your problems might come from that (please bear with me, I may be completely wrong about your business logic). Couldn't you change your model to something like this:

Party ->> ContactMechanism (optional)

ContactMechanism->ContactMechanismType (mandatory)
ContactMechanism->ContactMechanisUsage (mandatory)

I deliberately wrote the above on two different lines to make things clearer.

ContactMechanism could have one String attribute that can hold an email address, a phone number, anything. It's interpretation is according to the mandatory to-one ContactMechanismType, it's usage (home, work, etc) is governed by the mandatory to-one ContactMechanismUsage.

I think this model covers everything you want (unless I completely misunderstand your problem), it is properly normalized. And it should work nicely with D2W.

Hope this helps
---markus---

On 20.05.2014, at 16:36, Ângelo Andrade Cirino <email@hidden> wrote:

Hi,

I modeled the following relationships

Party ->> ContactMechanism -> Email
Party ->> ContactMechanism -> Phone
Party ->> ContactMechanism -> PostalAddress

And flattened the relationships into Party. My D2W rules are setup so that this to many relationships are edited with a ERMODEditRelationshipPage component. The to one relationships from ContactMechanism to the other entities are optional, since a ContactMechanism can be either an Email, a Phone or a PostalAddress, but not two of them at the same time.

I am able to edit the flattened entities but when the Party entity is saved the following exception is raised:

IllegalStateException: A valid global ID could not be obtained for entity named ContactMechanism, relationship named contactMechanisms_phone, primary key dictionary {partyID = 2; phoneID = 7; }.
  at com.webobjects.eoaccess.EODatabaseContext.databaseOperationForIntermediateRowFromSourceObject(EODatabaseContext.java:4871)

I've searched the list and there are other similar cases where the solution was to change the model with the appropriate "owns destination" or "propagates primary key" properties for the intermediate relationship. From what I've read, even the delete rule can affect how EO will deal with the flattened relationships.

I didn't find a way to set up my model so that EO will handle the flattened relationships as I want. Or perhaps I am simply trying to do something the wrong way. Anyway, I need some help.

Thanx,

Angelo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)

This email sent to email@hidden


 _______________________________________________
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

References: 
 >Global ID problem with flattened relationship (From: Ângelo Andrade Cirino <email@hidden>)
 >Re: Global ID problem with flattened relationship (From: Markus Ruggiero <email@hidden>)

  • Prev by Date: Re: Global ID problem with flattened relationship
  • Next by Date: Re: Which RIA
  • Previous by thread: Re: Global ID problem with flattened relationship
  • Next by thread: Re: Linking iOS and WebObjects
  • Index(es):
    • Date
    • Thread