select new DocumentTransfer(d.NO,d.Title,d.CompanyName,d.CreatedBy,d.DocumentType,p.Status,d.CreatedOn,d.Id)  from DocumentTransfer d,DocumentUserOrDepart p where d.Id=p.DocumentId and p.UserId=:UserId and d.DocumentType=:DocumentType and p.Status=:Status order by p.Status

解决方案 »

  1.   

    d.DocumentType=:DocumentType一看这两个眼睛就不像是MSSQL的语法
      

  2.   

    我也看不懂.不过我看懂这个不是SQL SERVER的.
      

  3.   

    select new DocumentTransfer(d.NO,d.Title,d.CompanyName,d.CreatedBy,d.DocumentType,p.Status,d.CreatedOn,d.Id) from DocumentTransfer d,DocumentUserOrDepart p where d.Id=p.DocumentId and p.UserId=:UserId and d.DocumentType=:DocumentType and p.Status=:Status order by p.Status
    Hibernate HQL查询语句 面向对象的操作对数据库进行操作new DocumentTransfer(d.NO,d.Title,d.CompanyName,d.CreatedBy,d.DocumentType,p.Status,d.CreatedOn,d.Id)==>new DocumentTransfer(int No,String title....)符合这个规则的构造器的参数..
    如:
    要查询table b(class b) table c(class c)两个表中的组合字段的时候为了作为对象操作我们会定义一个class a 使用以下HQL语句查询   select new a(b,c) from b,c where ......   在使用这样的语句的时候 class a 中必须有 public a(b b1, c c1)的构造方法