How can I get all rows with "where" clause from 4 database tables and put them in response API list of objects?

39 views Asked by At

How can i get all rows with "where id=123" filter from DB? I have 4 tables (t1-< t2, t2-<t3, t3-<t4 - from first table to last OneToMaNY) in DB and put it in response api List of objects?

I try to use @Query in JpaRepository interface for my entity, but it doesn't work.

All 4 tables were created from entity classes with annotations

first entity T1 have @OneToMany(mappedBy = "Id", fetch = FetchType.EAGER) private Set t2;

second entity T2 have

@OneToMany(mappedBy = "Id", fetch = FetchType.EAGER) private Set t3;

second entity T3 have

@OneToMany(mappedBy = "id", fetch = FetchType.EAGER)
private Set<T4> t4;

Response api is List which include all fields from tables above

Request has only one parameter in path {id}, using for sort rows in db in "where" operator

How can i get all rows with "where" filter from 4 tables (t1-< t2, t2-<t3, t3-<t4) in DB and put it in response api List of objects?

Tried to find all rows from tables in single select, without join

0

There are 0 answers