cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lachlan Deck <>
Subject Re: NamedQuery / SQLTemplate keyPath validation
Date Tue, 10 Jun 2008 07:31:16 GMT
Hi Andrus,

thanks for the reply...

On 10/06/2008, at 5:12 PM, Andrus Adamchik wrote:

> 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.


Perhaps I should describe what I'm actually doing. All I need is a way  
to get a count of a select query (without having to fault in all the  
related objects). So is there a way to trigger that, in order to just  
get a count back, with a SelectQuery without going the sqltemplate or  
namedquery route?

> 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.

Would that help here?

Sorry the subject was misleading... I ended up changing the body from  
its original - where I was finding that foreign keys in the expression  
were being validated and it was throwing an exception because they  
weren't public members... but that's another (albeit related) topic.

with regards,

Lachlan Deck

View raw message