cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: NamedQuery / SQLTemplate keyPath validation
Date Tue, 10 Jun 2008 07:22:12 GMT
But maybe I misunderstood your goal with that? What about "kePath  
validation" in the subject?

Andrus

On Jun 10, 2008, at 10:12 AM, Andrus Adamchik wrote:

> Hi Lachlan,
>
> there is nothing there that would let you do that outside the  
> context of query execution. One reason why we never pursued such  
> functionality is because ... well, such context is needed:
>
> * you need a place to stick joins as you walk the expression path
> * you need a way to match bound variables against "?" in prepared  
> statement (we don't do conversion from Date to String for instance,  
> as there is no sane way to do that for all databases; we let JDBC  
> driver handle bindings)
> * you need access to specific DbAdapter to generate correct SQL and  
> correctly process bindings.
>
> The closest thing to what you describe is a procedure of translation  
> of an EJBQL query (which is logically, but not semantically is a  
> close analog of SelectQuery) to SQLTemplate. It is also done in the  
> context of query execution, but with some effort it can probably be  
> converted to a standalone SQLTemplate without execution.
>
> Andrus
>
>
> On Jun 10, 2008, at 9:26 AM, Lachlan Deck wrote:
>> Hi there,
>>
>> (question related to ROP)
>>
>> say I've got an Expression (whether complex or otherwise) and I  
>> want to utilise that Expression in a NamedQuery or SQLTemplate...  
>> what's the easiest way to transform the expression to an sql  
>> equivalent string? (i.e., such that, e.g.,, boolean values are  
>> transformed from say true to 1 (if using an int column), dates are  
>> formatted appropriately etc, comparison operators are transformed  
>> (e.g., != to <>) etc.
>>
>> I see that there's a QueryAssembler and QualifierTranslator etc,  
>> but what I'm looking for, I guess, is a something like  
>> expression.toSQLString(baseEntity).
>>
>> Any suggestions?
>>
>> Thanks.
>>
>> with regards,
>> --
>>
>> Lachlan Deck
>>
>>
>
>


Mime
View raw message