Well I don't know the particular reason, but I rewrite a query using getSession().createQuery() and it started working, before I was using our GenericDao it uses getHibernateTemplate.
Why this simple hql query doesn't work? uncategorized SQLException
-
11-07-2023 - |
Question
I have two tables: Research and userResearch, Research has userResearches list mapped to userResearch using @OneToMany. I'm trying to execute a simple hql query
from Research r inner join r.userResearches ur where ur.user=:user
and get this exception:
Hibernate operation: could not execute query; uncategorized SQLException for SQL [select...]; SQL state [24000]; error code [0]; Operation requires a scrollable ResultSet, but this ResultSet is FORWARD_ONLY.; nested exception is org.postgresql.util.PSQLException: Operation requires a scrollable ResultSet, but this ResultSet is FORWARD_ONLY.
What can be the reason? Entities are mapped right, everything works fine, I can retrive both entities using criteria API.
@Entity
public class UserResearch extends ManagedEntity {
@ManyToOne
@JoinColumn(name = "research_id")
private Research research;
@Entity
public class Research extends ManagedEntity {
@OneToMany(mappedBy = "research")
private Set<UserResearch> userResearches = new HashSet<UserResearch>(0);
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow