Declarative JDOQL vs Single-String JDOQL : performance

Posted by DrDro on Stack Overflow See other posts from Stack Overflow or by DrDro
Published on 2010-05-28T07:30:52Z Indexed on 2010/05/28 10:02 UTC
Read the original article Hit count: 343

Filed under:
|
|
|

When querying with JDOQL is there a performance difference between using the declarative version and the Single-String version:

Example from the JDOQL doc:

//Declarative JDOQL :
Query q = pm.newQuery(org.jpox.Person.class, "lastName == \"Jones\" && age < age_limit");
q.declareParameters("double age_limit");
List results = (List)q.execute(20.0);

//Single-String JDOQL :
Query q = pm.newQuery("SELECT FROM org.jpox.Person WHERE lastName == \"Jones\"" +
                      " && age < :age_limit PARAMETERS double age_limit");
List results = (List)q.execute(20.0);

Other then performance, are there any reasons for which one is better to use then the other or is it just about the one with which we feel more comfortable.

© Stack Overflow or respective owner

Related posts about java

Related posts about Performance