Parameters are *arbitrary* "variables" that start with a "$" sign. They do not have to match the attribute names. You would define them in CayenneModeler for the query. For SelectQuery this would be the part of the qualifier string, i.e. "loginid = $id" . In SQLTemplate they are defined in the SQL (SELECT * FROM X WHERE T = $myP).

Andrus


On Jul 24, 2006, at 10:46 AM, Marcel wrote:


Hi all,

The following is from the wiki[1]:

---------------
String[] keys = new String[] {"loginid", "password"};
Object[] values = new String[] {"joe", "secret"};

NamedQuery query = new NamedQuery("Login", keys, values);

List matchingUsers = context.performQuery(query);
---------------

I had presumed that this executes the query Login finding users where loginid = "joe" and password = "secret.

Do the parameters need to be defined in the query beforehand? If so, how? If not, are they object attribute names or database attribute names?

Cheers,

Marcel

[1] http://cwiki.apache.org/CAYDOC/namedquery.html


Reply via email to