hibernate - Why I get "Parameter value [appa] did not match expected type [java.lang.Integer (n/a)]"? -
i don't understand why error. seems right me. followings class definitions:
@entity @table(name = "product") public class product implements comparable<product>, java.io.serializable { //... protected section department; //... } public class section implements serializable { private string id; //... @id @column(name = "id") public string getid() { homecoming id; } }
and hql:
@suppresswarnings("unchecked") public list<product> findproductsbydepartment(final string deptid, string final int limit) { homecoming entitymanager .createquery( "select product left bring together ... ... , i.department.id = :deptid").setparameter("deptid", deptid).setmaxresults(limit).getresultlist(); }
the exception stack points statement setparameter("deptid", deptid). @id type can string (http://docs.oracle.com/javaee/6/api/javax/persistence/id.html). don't know why expects integer.
check product table (in database), because id field must numeric field (i supoose). mapping string, must alter type integer:
private integer id; //... @id @column(name = "id") public integer getid() { homecoming id; }
java hibernate
No comments:
Post a Comment