I'm creating a small forum. The entities and their relations are like this:
Entity Topic
has a OneToMany
relation to Post
, Post
has a ManyToOne
relation to User
I want to get all topics for one specific user by checking the author of the first post in each topic. Here is my JPQL:
SELECT t FROM Topic t JOIN t.posts p WHERE p.user=:user
But this WHERE will check all posts in topic, I only want to check the first post (This user will be considered as the author of the topic).
Thanks