这个sql语句应该怎么写 ?
select   count(e.Id)   from   Books   e   (where   e.bokState=1)
------解决方案--------------------..... 
 这里的query是直接的sql语句啊,不用HQL语句的。 
 select count(id) from Books where bokstate=1   //id,bokstate跟数据库里的列名对应
------解决方案--------------------你写到books.hbm.xml这里这样定义当然是直接的sql了,以为你写的服务层呢,你用的什么架构呀