How can i add "where" to my request to db from java in JPQL?
I have in service class call method from JpaRepository interface:
List t1List = T1Repository.findById(id) // this is not a PK
id - field from REST API request
And JpaRepository interface looks like:
public interface T1Repository extends JpaRepository<T1, Long> {
@Query("select m from T1 m LEFT JOIN FETCH m.T2 where m.id= :id")
List<T1> findById(@Param("id") String id);
}
If i remove "where m.id= :id" it will response with all rows from all tabs, but with "where m.id= :id" - it response nothing
Help please
above all that try to use
Try changing
where m.id= :idwith this:
where m.id= ?1