select * from (select * from t_P p where p.projectStatus =2)t1 where t1.projectId not in ( select b.projectId from t_Bb where b.bidderId =2)这个SQL在oracle里肯定没问题,但是转成HQL就不行,请问该怎么写?
实体嵌套比较麻烦,内存占用多,建议使用NativeSQL。如果真要写HQL。from 实体类 inner join 实体类关联主键 inner join 实体类关联主键 =NULL(对应Not IN)你也可以这样写:select {别名.*} from 主表 别名 inner join A on(主键关联序列) inner join B on(主键关联序列) where 条件序列 and XXXB.XXX IS NULL对别名 填充实体。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货