我正在编辑现有项目。我的任务是将Integer主键转换为UUID。我已经编辑了数据库,但现在我遇到了Hibernate的问题。
在此功能中:
public List<ResearchGroup> getResearchGroupsWhereMember(Person person, int limit) {
String hqlQuery = "from ResearchGroup researchGroup "
+ "where researchGroupId in (select rgm.id.researchGroupId from ResearchGroupMembership rgm where id.personId = :personId) "
+ "order by researchGroup.title";
getHibernateTemplate().setMaxResults(limit);
List<ResearchGroup> list = getHibernateTemplate().findByNamedParam(hqlQuery, "personId", person.getPersonId());
getHibernateTemplate().setMaxResults(0);
return list;
}
我明白了:
org.postgresql.util.PSQLException: ERROR: operator does not exist: uuid = bytea
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Person id是java.util.UUID对象。
@Type(type="pg-uuid")
我认为findByNamedParamFunction()存在问题。
如何更换?