0 Replies Latest reply on Dec 12, 2006 5:35 AM by Frank Cornelis

    COUNT(*) works, COUNT(entity) not

    Frank Cornelis Apprentice

      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?