Hibernate subquery

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

Published 18 original articles · won praise 0 · Views 352

Guess you like

Origin blog.csdn.net/Mr_ye931/article/details/105182598