mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Fix existing code for new hibernate sanity checks.
This commit is contained in:
parent
c298499a30
commit
f42a006d81
1 changed files with 4 additions and 4 deletions
|
@ -109,14 +109,14 @@ public class FeedHandlers {
|
||||||
CriteriaQuery<Video> criteria = cb.createQuery(Video.class);
|
CriteriaQuery<Video> criteria = cb.createQuery(Video.class);
|
||||||
var root = criteria.from(Video.class);
|
var root = criteria.from(Video.class);
|
||||||
root.fetch("channel", JoinType.RIGHT);
|
root.fetch("channel", JoinType.RIGHT);
|
||||||
var subquery = criteria.subquery(User.class);
|
var subquery = criteria.subquery(String.class);
|
||||||
var subroot = subquery.from(User.class);
|
var subroot = subquery.from(User.class);
|
||||||
subquery.select(subroot.get("subscribed_ids"))
|
subquery.select(subroot.get("subscribed_ids"))
|
||||||
.where(cb.equal(subroot.get("id"), user.getId()));
|
.where(cb.equal(subroot.get("id"), user.getId()));
|
||||||
|
|
||||||
criteria.select(root)
|
criteria.select(root)
|
||||||
.where(
|
.where(
|
||||||
root.get("channel").in(subquery)
|
root.get("channel").get("uploader_id").in(subquery)
|
||||||
)
|
)
|
||||||
.orderBy(cb.desc(root.get("uploaded")));
|
.orderBy(cb.desc(root.get("uploaded")));
|
||||||
|
|
||||||
|
@ -162,14 +162,14 @@ public class FeedHandlers {
|
||||||
CriteriaQuery<Video> criteria = cb.createQuery(Video.class);
|
CriteriaQuery<Video> criteria = cb.createQuery(Video.class);
|
||||||
var root = criteria.from(Video.class);
|
var root = criteria.from(Video.class);
|
||||||
root.fetch("channel", JoinType.RIGHT);
|
root.fetch("channel", JoinType.RIGHT);
|
||||||
var subquery = criteria.subquery(User.class);
|
var subquery = criteria.subquery(String.class);
|
||||||
var subroot = subquery.from(User.class);
|
var subroot = subquery.from(User.class);
|
||||||
subquery.select(subroot.get("subscribed_ids"))
|
subquery.select(subroot.get("subscribed_ids"))
|
||||||
.where(cb.equal(subroot.get("id"), user.getId()));
|
.where(cb.equal(subroot.get("id"), user.getId()));
|
||||||
|
|
||||||
criteria.select(root)
|
criteria.select(root)
|
||||||
.where(
|
.where(
|
||||||
root.get("channel").in(subquery)
|
root.get("channel").get("uploader_id").in(subquery)
|
||||||
)
|
)
|
||||||
.orderBy(cb.desc(root.get("uploaded")));
|
.orderBy(cb.desc(root.get("uploaded")));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue