4

I am editing existing project. My task is transform Integer primary keys to UUIDs. I have already edited database, but now I have problem with Hibernate.

In this function:

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;
}

I get:

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 is java.util.UUID object.

@Type(type="pg-uuid")

I think there is problem with findByNamedParamFunction().

How can it be replaced?

user2275785
  • 199
  • 1
  • 19

0 Answers0