I have two questions concerning @JoinFormula and @OneToMany annotations:
How can I limit the number of result with
@JoinFormula
and@OneToMany
annotations?How can I define that
id
in expressionauthor = id
refers toAuthor.id
?Author { @Id private Long id; @OneToMany @JoinFormula(value = "SELECT a FROM Article a WHERE author = id AND schedule < CURRENT_TIMESTAMP()") // limit = 15 private List<Article> pastArticles; }
Like this, I keep having the pastArticles empty, even when I remove the schedule <
part of the clause.
Thanks!