I don’t understand why you try to flatten a to-one relationship. You can 
flatten an attribute or a many2many relationship.

Creating a many2many relationship is pretty straightforward: when you create a 
relationship between 2 entities, you choose to many on both sides, give a name 
to the join entity and check “flatten”.

Regarding your code, I don’t get you when you say “not work well with this 
relationship”. Is it the one to try to flatten? If you have issues with the 
relationship, it’s not surprising you don’t get the expected results, right?

Why the test "if ( cd.toOneRelationshipKeys().contains(sv1)) "? I suppose you 
get an exception before if sv1 is not a valid relationship key…

And I’m a bit surprised you still use accented characters (Lycée). That’s 
something I would never play with…

Philippe
 
On 2 mars 2014, at 09:36, Jean Pierre Malrieu <[email protected]> wrote:

> Hi,
> 
> I am trying to make a flattened to-one relationship (Enqueteur -> Lycée 
> instead of Enqueteur -> Classe -> Lycée)  . Using Entity Modeller I navigate 
> down the relation in the outline view then click the flatten button.
> Below is what I get in Entity Modeller:
> 
> 
> <Capture d’écran 2014-03-02 à 09.18.02.png>
> 
> My first problem is that Entity Modeller now complains that the relationship 
> has no join... How do I solve this?
> 
> My second problem is with that filteredArrayWithQualifier does not seem to 
> work well with this relationship. Here is the code I am using
> 
> EOClassDescription v1cd = cd.classDescriptionForDestinationKey(sv1);
> if ( cd.toOneRelationshipKeys().contains(sv1))
>     v1Qual= new EOKeyValueQualifier(sv1, EOQualifier.QualifierOperatorEqual, 
> lycee);
> NSArray<EOGenericRecord> objectsInRow = 
> EOQualifier.filteredArrayWithQualifier(relevantObjects, v1Qual);
> 
> Now in objectsInRow, I only get a part of the objects I would expect.
> Suppose there are student objects that belong to college1 because they belong 
> to schoolclass1 (which belongs to college1).
> Suppose there are students objects that belong to college1 because they 
> belong to schoolclass2 (which belongs to college1).
> Then it seems that filteredArrayWithQualifier returns only students for 
> schoolclass1...
> 
> Again, what I am doing wrong?
> 
> TIA
> 
> JPM
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/prabier%40me.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to