How to query all posts by tag_id in Postgres ManyToMany Relationship in spring JPA repository?
How to query all posts by tag_id in Postgres ManyToMany relationship in Spring JPA repository?
These are the tables:
post
post_tag
tag
id
id_post
id
..
id_tag
..
If I query the PostgreSQL directly via pg_admin Query tool the following sql is working:
SELECT * FROM post WHERE ID IN (
select post_id from post_tag tag WHERE (tag_id = '12'))
I like to have this query in my JPA Repository, but the following isn't working.
@Query(value = "SELECT * FROM post WHERE ID IN (select post_id from...