Hi,


On 2016-03-02, 4:30 PM, "OC" <[email protected]> wrote:

>Chuck,
>
>On 2. 3. 2016, at 21:18, OC <[email protected]> wrote:
>
>>> Defining additional entities with the appropriate restricting qualifiers 
>>> for these conditions might possibly work.  Then you could define the 
>>> flattened relationship in terms of these restricted entities.
>> 
>> ... Thank you for the advice; I'll check the possibility of qualified 
>> entities (of which I completely have forgot!), it might lead to a cleaner 
>> and more efficient code.
>
>Hmmm, let me see whether I understood you properly. At the moment, I have
>
>(a) entities Auction, UserAuction, User
>(b) relationships Auction.userAuction ->> UserAuction and UserAuction.user -> 
>User
>
>For given Auction, I need to model a relationship auctionOwner -> User, 
>defined (for the testing at the moment simply) as
>(i) Auction.userAuction.user exists
>(ii) Auction.userAuction.user.userType==4
>
>So, I have
>
>- defined a new entity OwnerAuction, which is essentially a copy of 
>UserAuction, but contains 'restrictingQualifier = "user.userType = 4";'

Isn’t that one supposed to restrict accessAllowed?  I think you would want the 
userType=4 restriction on OwnerAuctionUser (or whatever you want to call it).



>- defined a new relationship Auction.internalOwnerAuction -> OwnerAuction, 
>with precisely same join as Auction.userAuction
>- defined a flattened relationship Auction.ownerAuction -> User, defined as 
>"internalOwnerAuction.user"
>
>This is what you meant, or did I do something wrong?

That is not quite what I had in mind, see above.


>
>Anyway, this, alas, does not quite work. If I fetch OwnerAuction directly, its 
>restrictingQualifier kicks in all right, and I am getting only items whose 
>user.userType==4, so far so good; the generated SQL is all right, looking 
>generally like this:
>
>SELECT ... FROM "T_USER_AUCTION" t0, "T_USER" T1 WHERE T1."C_USER_TYPE" = 4 
>AND ...
>
>Nevertheless, if I access the entity through either the internalOwnerAuction 
>or the flattened ownerAuction relationship, I am always getting _all_ the 
>items -- it looks like in this case, restrictingQualifier is simply ignored. 
>The generated SQL looks generally like this:
>
>SELECT ... FROM "T_AUCTION" t0, "T_USER" T2, "T_USER_AUCTION" T1 WHERE ... AND 
>T1."C_USER_ID" = T2."C_UID" AND t0."C_UID" = T1."C_AUCTION_ID"
>
>It properly refers to all the tables, but uses only the joins, does not limit 
>the results through the OwnerAuction entity restrictingQualifier: there is 
>never anything like 'AND T2."C_USER_TYPE" = 4' in the generated SQL.
>
>What did I do wrong? Have I forgot to set up something properly?

It was just an idea on how you might abuse EOF to achieve your goal.  It might 
not work.

Chuck


 _______________________________________________
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