Hibernate detached queries as a part of the criteria query
问题 java experts can you please help me write detached queries as a part of the criteria query for the following SQL statement. select A.* FROM AETABLE A where not exists ( select entryid FROM AETABLE B where B.classpk = A.classpk and B.userid = A.userid and B.modifiedDate > A.modifiedDate ) and userid = 10146 回答1: You need to write a correlated subquery. Assuming property / class names match column / table names above: DetachedCriteria subquery = DetachedCriteria.forClass(AETable.class, "b")