-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: CriteriaQuery/count/idClass error
PostPosted: Sun Nov 21, 2010 6:06 pm 
Newbie

Joined: Mon Aug 27, 2007 4:08 am
Posts: 8
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.