Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张桌子和一个标@Entity有
@Entity
@Table(name="Employee")
它有两个字段,Id 和 Name
我想在同一张桌子上做左连接,比如,
Select t2.name, count(*) from Employee t1 left join Employee t2 on t1.Id = t2.Id where t1.Name = 'asd' group by t2.Name
我有一个解决方法,我将该查询转换为子查询
Select EmployeeID From Employee Where ManagerID in (Select EmployeeID where performance >= 4 )
并使用了 DetachedCriteria,我得到了它的工作。但这会降低我的表现。所以我会试试你的方法,看看我能不能让它工作
参考 https://forum.hibernate.org/viewtopic.php?p=2389790