Re: Expression to compare a property against another property

Faizel Dakri <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi John,

I am developing against 4.2 right now. I will have to take a closer look at the Property methods again—it may be so obvious that I missed it.

Thanks for the help, though. At least I know where to look.

Regards,

F

-- 
Faizel Dakri


> On Sep 10, 2020, at 05:10 PM, John Huss <[email protected]> wrote:
> 
> The generated Property instances in the model classes support this out of
> the box, but maybe you are using an older version of Cayenne?
> 
> On Thu, Sep 10, 2020 at 4:00 PM Faizel Dakri <[email protected]> wrote:
> 
>> Is there a facility in Cayenne to create an expression that would compare
>> a property of one object against another property (maybe via a relationship
>> path rooted at the same object) rather than against a scalar value?
>> 
>> I’m trying to port over some old EOF code and we used to have a
>> EOKeyComparisonQualifier which would allow you to create a qualifier to
>> compare a property’s value with that of another property (or property key
>> path).
>> 
>> For example, given a model consisting of employees, where each employee
>> can have a relationship to a manager and each employee has a salary
>> property, you could use a key comparison qualifier to find those employees
>> that are making more than their manager:
>> 
>>        salary > manager.salary
>> 
>> I’ve looked in ExpressionFactory and through some of the source, but to me
>> it looks like all comparison nodes in an expression operate on a key and a
>> scalar. Am I missing something?
>> 
>> Thanks for any help or pointers,
>> 
>> F
>> 
>> --
>> Faizel Dakri
>> 
>> 
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.