Re: EJBQL and parameters

2009-04-09 Thread Francois Eyl
Robert, thanks for your advises, appreciated. I finally made my own EJBQLTemplateQuery using velocity. This works for me. Still, I'm intrigued by the idea of being able to directly script > EJBQLQuery. Anybody else think that's interesting? If there's a favorable > consensus, I'll add an issue an

Re: EJBQL and parameters

2009-04-09 Thread Andrus Adamchik
On Apr 9, 2009, at 11:47 AM, Robert Zeigler wrote: Now that I'm thinking about this more... even though EJBQLQuery doesn't support the above scheme, there's no reason you can't tap into velocity yourself to accomplish what you want. Exactly my thoughts. Still, I'm intrigued by the idea of

Re: EJBQL and parameters

2009-04-09 Thread Robert Zeigler
I think the main problem with trying to use parameters the way you are with EJBQLQuery is the meaning of "parameters": they're supposed to be bound to SQL types. At the same time, the "column names" are really object property names, which means they have to be translated at the time the query

Re: EJBQL and parameters

2009-04-09 Thread Francois Eyl
I already use a lot of SelectQuery and even some SQLTemplate. My problem with SelectQuery is the fact that it fetches all columns information for a table and so, can be expensive for specific needs where I need high performances (here only need ids, so only 1 column to return rather than 25 -> mor

Re: EJBQL and parameters

2009-04-08 Thread Robert Zeigler
Two thoughts. 1) You're not doing anything that /requires/ EJBQLQuery. So, if you're /really/ interested in using the cayenne-provided constants, switch to SelectQuery. SelectQuery q = new SelectQuery(UserSchedule.class);//<-- see? Type safety... :) Expression e = ExpressionFactory

Re: EJBQL and parameters

2009-04-08 Thread Francois Eyl
oh, sorry it's my bad. I did a typing mistake I wanted to type : query.setParameter("SKDID", UserSchedule.SCHEDULE_ID_PROPERTY); Robert, you right, I'm trying to use paramters to specify Columns and so use available constants coming from Cayenne. This way, even if columns name change, nothing to c

Re: EJBQL and parameters

2009-04-08 Thread Robert Zeigler
Hm. I've never thought about specifying the columns and table via parameters. Event supposing that this works (not convinced it does/will), do you actually have a property named 1 in the UserSchedule entity (select us.:SKDID...setParameter("SKDID",1) => select us.1)? Try specifying the entity

EJBQL and parameters

2009-04-08 Thread Francois Eyl
Howdy guys, I'm trying to use EJBQL query and parameters, but I can't get it to work. Is there something special for ? Bellow is a quick sample of what I'm doing : String queryString = "SELECT us.:SKDID FROM :USCHED us WHERE us.:UID=1"; EJBQLQuery query = new EJBQL