To-Many Qualifiers
To-Many Qualifiers
- Subject: To-Many Qualifiers
- From: Kevin Hinkson <email@hidden>
- Date: Mon, 14 Apr 2014 16:49:10 -0400
Hello,
I was hoping someone would be able to point me in the direction of how to handle generating a to many qualifier that involves a key path (not just a single key).
A code example:
// Generates a qualifier for the Profile for this account and the Profiles of any account on the same team (or that is the intention)
public static EOQualifier visibleToAccountQualifier(Account account)
{
EOQualifier profilesDirectlyTiedToAccount = Profile.ACCOUNT.eq(account);
String teamProfilesKeyPath = ERXQ.keyPath(Profile.ACCOUNT_KEY, Account.TEAMS_KEY, Team.ACCOUNTS_KEY);
EOQualifier teamProfilesQualifier = ERXQ.has(teamProfilesKeyPath, new NSArray<Account>(account));
return ERXQ.or(profilesDirectlyTiedToAccount, teamProfilesQualifier);
}
Performing a fetch with this qualifier generates the following error.
EvaluateExpression failed: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT DISTINCT t0.id FROM Profile t0 INNER JOIN Account T1 ON t0.accountID = T1.id INNER JOIN AccountTeam T2 ON T1.id = T2.accountId INNER JOIN Team T3 ON T2.teamId = T3.id INNER JOIN AccountTeam T4 ON T3.id = T4.teamId WHERE (T4.teamId IN ( SELECT Team.id FROM Team,AccountTeam null WHERE Team.id=T4.teamId AND null.accountId IN (1) GROUP BY Team.id HAVING COUNT(*)=1 ) OR t0.accountID = ?::int8)" withBindings: 1:1(accountID)>:
Next exception:SQL State:42601 -- error code: 0 -- msg: ERROR: syntax error at or near "null"
Position: 281.
There is a null in there where there shouldn't be one (on the inner select). Am I using this qualifier incorrectly or is this indicative of a modelling error or even a bug? If it helps, I'm using PostgreSQL.
_______________________________________________
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