有异常:
aggregate function expected before ( in SELECT [select distinct(t.scheduleId) from ZsSchedule t ,ZsPromulgator z where t.scheduleId = z.linkId and z.promulgate = '1']
不是HQL的 错误吧?

解决方案 »

  1.   

    ZsSchedule ,ZsPromulgator 是类名,scheduleId,linkId和promulgate ..是属性名,记住千万不要写表名,和字段名,而且这里是区分大小写的..
      

  2.   

    distinct后面有2个,例如:
    hql = "select distinct(t.scheduleId),z.caption from ZsSchedule t ,ZsPromulgator z where t.scheduleId = z.linkId and z.promulgate = '1'";这样可以么?
      

  3.   

    那就是这里错误了。
    还想问下。我向取2个字段,一个不能重复的。
    就像上面那两个。应该怎么写HQL。
      

  4.   

    那就是这里错误了。
    还想问下。我想取2个字段,其中有一个是不能重复的。
    就像上面那两个,第一个不能重复。应该怎么写HQL。
      

  5.   

    distinct(t.scheduleId),这里写错了吧,如过我没记错的话应该是这样写的distinct t.scheduleId,没括号吧.