请教一个关于hibernate查询列表的问题
Sessionsession=sessionFactory.openSession();StringqueryString="fromQuestionqwhereq.pr...
Session session = sessionFactory.openSession();
String queryString = "from Question q where q.projectId = ? and q.cqId = ? and q.cycleId = ?";
Query query = session.createQuery(queryString);
query.setString(0, ProjectId);
query.setString(1, CQ);
query.setString(2, CycleId);
List<Question> list = (List<Question>) query.list();
我写了一个hibernate查询列表,但是projectId在数据库里的格式是UUID,不是String。
直接按上面的方法查找的话报错:
------------------------------------------------------------------------------
ERROR: operator does not exist: uuid = character varying
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
-------------------------------------------------------------------------------
query.set也只有string,int等,没有UUID。请问这种怎么查询呢? 展开
String queryString = "from Question q where q.projectId = ? and q.cqId = ? and q.cycleId = ?";
Query query = session.createQuery(queryString);
query.setString(0, ProjectId);
query.setString(1, CQ);
query.setString(2, CycleId);
List<Question> list = (List<Question>) query.list();
我写了一个hibernate查询列表,但是projectId在数据库里的格式是UUID,不是String。
直接按上面的方法查找的话报错:
------------------------------------------------------------------------------
ERROR: operator does not exist: uuid = character varying
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
-------------------------------------------------------------------------------
query.set也只有string,int等,没有UUID。请问这种怎么查询呢? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询