Original hql :( sub-queries written in the from, the execution error)
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";
Modified 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 ) ";
Summary: hibernate sub-queries can only be used where written on the back