JDO Query - Find error

25 views
Skip to first unread message

Benjamin Lietzau

unread,
Feb 18, 2015, 7:30:16 AM2/18/15
to google-a...@googlegroups.com
Hello,

I get following error:

Problem with query <SELECT FROM de.hsowl.google.evaluation.model.Appointment WHERE userPara == createdBy PARAMETERS String userPara>: Unexpected expression type while parsing query: org.datanucleus.query.expression.ParameterExpression

the Method:
public List<Appointment> getAppointments(User user)
 
{
 
PersistenceManager pm = PMF.get().getPersistenceManager();
 
Query q = pm.newQuery(Appointment.class);
 q
.setFilter("userPara == createdBy");
 q
.declareParameters("String userPara");
 
List<Appointment> queryResult = (List<Appointment>) q.execute(user.getUserId());
 
return queryResult;
 
}


The important part of the object

@PersistenceCapable(detachable = "true")
public class Appointment implements javax.jdo.listener.StoreCallback
{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private String createdBy; //contains the userid
...
}


How can I declare the Parameter correct? 

Have a nice day
Benjamin
Reply all
Reply to author
Forward
0 new messages