传入参数
Long[]类型:userIds
Long类型:rid

Query q = getSession().createQuery("select user from User user join user.roles as role where role.id <>:ridand user.id not in( :uids)");
q.setParameter("rid",rid);
q.setParameter("uids",uids);

执行此段代码错误信息如下:
HQL in 关键字查询 报出“Ljava.lang.Long; cannot be cast to java.lang.Long“异常。

解决办法:

q.setParameter("userIds",userIds);
换为
q.setParameterList("userIds", userIds);

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2021-12-28
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-26
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案