I’m trying to get the latest revision of project
@ManyToOne(fetch = FetchType.LAZY)
@JoinFormula("(select r.id from {h-schema}project_revisions r where r.project_id = id order by id desc limit 1)")
private ProjectRevision latestRevision;
but hibernate generates:
(select r.id from {h-project0_.schema}project_revisions project0_.r
where r.project_id = project0_.id order by project0_.id desc limit 1)