I wrote a mistake :
select count(foo) com.my.bar.Foo foo works fine... except if Foo has a composite key.
The fault apparently comes from hibernate and seems to be known as the class Query of seam framework contains the following comment :
to be JPA-compliant, we need to make this query like select count(u) from User u
however, Hibernate produces queries some databases cannot run when the primary key is composite
I opened case HHH-4044 on this problem of count conversion.