On Sep 27, 2010, at 3:06 PM, Adrian Wiesmann wrote:

>> 
>> Or we can work together on supporting constructors in Expressions, similar
>> to how JPQL does:
>> 
>>   propertyXY = new java.util.UUID(1, 2)
> 
> I'd be willing to work on this. How can we proceed with that?

Cool. We may continue this discussion on the dev list. Let me start here by 
giving some pointers:

1. Get Cayenne code (3.0 or 3.1) 
2. Take a look at 
framework/cayenne-jdk1.5-unpublished//src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
 This is a JavaCC (specifically - JJTree) grammar of the Cayenne expression 
language.
3. Add support for "constructor expression" syntax to the grammar.
4. Implement processing of constructors in QualifierTranslator and for 
in-mempry evaluation
5. Create unit tests (likely add more test cases to the existing expression and 
SelectQuery tests)
6. Submit a patch.

BTW, checked the JPQL spec, and they only allow constructor in the "SELECT" 
clause. The above will support it in the WHERE clause, which is nice. We will 
also port that to EJBQLQuery at some point as well. 

Andrus

Reply via email to