我有一个查询
List<Integer> ids = sessionFactory.getCurrentSession()
.createSQLQuery("SELECT l.id FROM likes l INNER JOIN liketoanswers lta ON l.id = lta.id AND lta.answer_id = :a_id")
.setParameter("a_id",answer.getId())
.list();
List<Like> likes = new ArrayList<>();
for (Integer id : ids) {
likes.add(findById(id));
}
return likes;
我想将此查询设为。createQuery("from Like l inner join fetch likes.answers la where la.id = answer.getId ..)
但是word在sql中注册,并且不想更改实体类名。 我知道有一种替代类的方法,但找不到