在使用Hibernate创建子查询时遇到问题。不幸的是Subqueries类几乎完全没有文档,因此我完全不知道如何将以下SQL转换为Hibernate Criteria:
SELECT *,
(SELECT COUNT(*) FROM tweet.like WHERE tweet.like.postid = tweet.post.postid) AS like_count,
(EXISTS(SELECT 1 FROM tweet.like WHERE tweet.like.postid = tweet.post.postid AND tweet.like.userid = 29 )) AS islike
FROM tweet.post
INNER JOIN tweet.users ON tweet.users.userid = tweet.post.userid;