• 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: a trick to model a complex derived relationship?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a trick to model a complex derived relationship?


  • Subject: Re: a trick to model a complex derived relationship?
  • From: OC <email@hidden>
  • Date: Thu, 03 Mar 2016 01:30:58 +0100

Chuck,

On 2. 3. 2016, at 21:18, OC <email@hidden> 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";'
- 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?

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?

Thanks a lot,
OC


 _______________________________________________
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: a trick to model a complex derived relationship?
      • From: Chuck Hill <email@hidden>
References: 
 >a trick to model a complex derived relationship? (From: "ocs.cz" <email@hidden>)
 >Re: a trick to model a complex derived relationship? (From: Chuck Hill <email@hidden>)
 >Re: a trick to model a complex derived relationship? (From: OC <email@hidden>)

  • Prev by Date: Re: a trick to model a complex derived relationship?
  • Next by Date: Re: manually refreshing an AjaxTree
  • Previous by thread: Re: a trick to model a complex derived relationship?
  • Next by thread: Re: a trick to model a complex derived relationship?
  • Index(es):
    • Date
    • Thread