首页新闻招聘找找看知识库
  • 下面是我的HQL的字符串

     1 insert into OrderOnline.Model.sys.UserWorkAreaVO 2   (Product, SellPrice, ParValue, OrderType, AreaState) 3   SELECT x.Product, CAST(1 as Double), x.ParValue, x.OrderType, x.AreaState 4     FROM OrderOnline.Model.IWEC.WorkAreaVO as x 5    where 1 = 1 6      and x.ParValue = 0 7      and not exists (select y.Id 8             from OrderOnline.Model.sys.UserWorkAreaVO as y 9            where y.Product.Id = x.Product.Id10              and y.ParValue = x.ParValue11              and y.OrderType = x.OrderType12              and y.User.Id = 2)13      and exists (select y.Id14             from OrderOnline.Model.ProductVO as y15            where y.Id = x.Product.Id16              and y.City.Parent.Id = 22817              and y.City.Id = 2830)18      and exists (select y.Id19             from OrderOnline.Model.WorkListVO as y20            where y.Id = x.Work.Id21              and y.Id = 2)22      and x.AreaState = 023      and x.OrderType = 2

    执行下面的语句

      _result = s.CreateQuery(_hql).ExecuteUpdate();

    错误could not execute update query

    提示的

    列前缀 'IWEC_WorkArea' 与查询中所用的表名或别名不匹配。
    列前缀 'IWEC_WorkArea' 与查询中所用的表名或别名不匹配。
    列前缀 'IWEC_WorkArea' 与查询中所用的表名或别名不匹配。
    列前缀 'IWEC_WorkArea' 与查询中所用的表名或别名不匹配。
    列前缀 'IWEC_WorkArea' 与查询中所用的表名或别名不匹配。

    产生的Sql语句是

    insert into sys_UserWorkArea  (Product_Id, SellPrice, ParValue, OrderType, AreaState)  select workareavo0_.Product_Id as col_0_0_,         cast(1 as DOUBLE PRECISION) as col_1_0_,         workareavo0_.ParValue as col_2_0_,         workareavo0_.OrderType as col_3_0_,         workareavo0_.AreaState as col_4_0_    from IWEC_WorkArea workareavo0_   where 1 = 1     and workareavo0_.ParValue = 0     and not          (exists (select userworkar1_.fid                     from sys_UserWorkArea userworkar1_                    where userworkar1_.Product_Id = IWEC_WorkArea.Product_Id                      and userworkar1_.ParValue = IWEC_WorkArea.ParValue                      and userworkar1_.OrderType = IWEC_WorkArea.OrderType                      and userworkar1_.User_Id = 2))     and (exists (select productvo2_.fid                    from Product productvo2_, sys_Dictionary dictionary3_                   where productvo2_.City_Id = dictionary3_.fid                     and productvo2_.fid = IWEC_WorkArea.Product_Id                     and dictionary3_.Parent_Id = 228                     and productvo2_.City_Id = 2830))     and (exists (select worklistvo4_.Id                    from WorkList worklistvo4_                   where worklistvo4_.Id = IWEC_WorkArea.Work_Id                     and worklistvo4_.Id = 2))     and workareavo0_.AreaState = 0     and workareavo0_.OrderType = 2

     

    很奇怪的问题Hql的exists里面的明明是用x别名,为什么生成sql不是workareavo0_这个别名呢

登录后才能评论,请先登录注册