Hello. I am trying to upgrade from Hinernate 3.3
Error:
Code:
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using scroll
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.scroll(Loader.java:2402)
at org.hibernate.loader.criteria.CriteriaLoader.scroll(CriteriaLoader.java:114)
at org.hibernate.impl.SessionImpl.scroll(SessionImpl.java:1670)
at org.hibernate.impl.CriteriaImpl.scroll(CriteriaImpl.java:361)
at com.acula.dao.hibernate.AculaHibernateUtils.getTotalCount(AculaHibernateUtils.java:61)
at com.acula.dao.hibernate.UserDaoHibernate$39.doInHibernate(UserDaoHibernate.java:1341)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
... 118 more
Caused by: org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "role3_"
in my java code:
Code:
@ManyToMany(targetEntity = Role.class, fetch = FetchType.EAGER)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JoinTable(name = "user_roles",
joinColumns = {@JoinColumn(name = "user_id", nullable = false)},
inverseJoinColumns = {@JoinColumn(name = "role_id", nullable = false)}
)
@BatchSize(size = 20)
public Set<Role> getRoles() {
return roles;
}
...
Criteria cr = s.createCriteria(User.class);
cr.setProjection(Projections.projectionList()
.add(Projections.groupProperty("id"))
)
.createAlias("roles", "role")
....
Is it a workaround for this?