Hi, Im using CriteriaQuery for my abstract Query class that's try to count my user/group relations
CriteriaQuery<Long> criteriaQuery = getCriteriaBuilder().createQuery(Long.class);
Root root = criteriaQuery.from(UserGroup.class);
criteriaQuery.select(getCriteriaBuilder().count(root));
.....
Code:
@Entity
@Table(name = "usergrups")
@IdClass(UserGroupId.class)
public class UserGroup.....
.....
UserGroupId class have two members in id but have a problems when the query is excuted....
Code:
select count((usergroup0_ .username, usergroup0_ .groupname)) as col_0_0_ from usergroup usergroup0_ limit ?
4016 [pool-1-thread-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1241, SQLState: 21000
4016 [pool-1-thread-1] ERROR org.hibernate.util.JDBCExceptionReporter - Operand should contain 1 column(s)
Any idea how i can resolve it?