Query[User] query = Ebean.createQuery(User.class);query.setId(1);List[User] userList = query.findList();
This will fail with a nasty stackTrace...
Exception in thread "main" javax.persistence.PersistenceException: Error with property[1] dt[4]data[1][java.lang.Integer] at com.avaje.ebean.server.persist.Binder.bindSimpleData(Binder.java:365) at com.avaje.ebean.server.persist.Binder.bindObject(Binder.java:251) at com.avaje.ebean.server.persist.Binder.bindObject(Binder.java:209) at com.avaje.ebean.server.deploy.idconvert.IdBinderSimple.bindId(IdBinderSimple.java:32) at com.avaje.ebean.server.deploy.BeanDescriptor.bindId(BeanDescriptor.java:510) at com.avaje.ebean.server.query.PredicateBinder.bind(PredicateBinder.java:88) at com.avaje.ebean.server.query.InternalSqlQuery.prepareBindExecuteQuery(InternalSqlQuery.java:146) at com.avaje.ebean.server.query.FinderObjectRelational.findMany(FinderObjectRelational.java:121) at com.avaje.ebean.server.query.DefaultInternalQueryEngine.findMany(DefaultInternalQueryEngine.java:83) at com.avaje.ebean.server.core.QueryRequest.findList(QueryRequest.java:148) at com.avaje.ebean.server.core.DefaultServer.findList(DefaultServer.java:844) at com.avaje.ebean.query.DefaultBeanQuery.findList(DefaultBeanQuery.java:274) at query.FindUser.main(FindUser.java:27)Caused by: java.sql.SQLException: No parameters defined during prepareCall() at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) at com.mysql.jdbc.ServerPreparedStatement.getBinding(ServerPreparedStatement.java:751) at com.mysql.jdbc.ServerPreparedStatement.setInt(ServerPreparedStatement.java:1759) at com.avaje.lib.sql.ExtendedPreparedStatement.setInt(ExtendedPreparedStatement.java:293) at com.avaje.ebean.server.persist.Binder.bindSimpleData(Binder.java:293) ... 12 more
Basically.... setId() was ignored when building the sql, but not when binding the sql. Hence the error binding.
This should not be a common error, because you are unlikely to use setId() with findList()... unless like me you stumbled onto it.
I figure it is valid enough so I have fixed it.
Fixe in 0.9.5b