[jboss-user] [EJB 3.0] - COUNT(*) works, COUNT(entity) not

fcorneli do-not-reply at jboss.com
Tue Dec 12 05:35:31 EST 2006


I have an @Entity with composite @EmbeddedId primary key. When I do a query like:
SELECT COUNT(*) FROM TheEntity AS theEntity WHERE theEntity.blablablabla
then everything works, but when I replace this with:
SELECT COUNT(theEntity) FROM TheEntity AS theEntity WHERE theEntity.blablabla
then Hibernate fails on it with the following error:
Caused by: java.sql.SQLException: Syntax error: Encountered "," at line 1, column 39.
The SQL statement that he tried to execute looks like
select count((theEntity.a, theEntity.b)) as col_0_0_ from TheEntity theEntity where theEntity.a=?
I'm using the default HSQL DefaultDS that comes with JBoss 4.0.5.GA
Is this a bug, or is it just me?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993011#3993011

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993011



More information about the jboss-user mailing list