原始hql:(子查询写在from中,执行报错)
String hql = "select q from TWorkAutoQueue q ,( "
+"select distinct e.extId "
+"from YIProcessExt e,TWorkitem t "
+"where t.processInsId = e.extProcessInsId ) ext "
+"where ext.extid = q.extid";
修改后hql:
String hql = "select q from TWorkAutoQueue q "
+"where q.extId in( "
+"select distinct e.extId "
+"from YIProcessExt e,TWorkitem t "
+"where t.processInsId = e.extProcessInsId ) ";
总结:hibernate中使用子查询只能写在where后面