I have tiered objects configured and successfully matched, and everything works as expected.
Now I want to use a custom query in which I join several entities and define some where clauses are.
public interface GiataItemRepository extends JpaRepository<GiataItem, String>{
@Query(value="select g from GiataItem g "
+ "join g.service s "
+ "join s.section se "
+ "join se.secPic sp "
+ "where g.giataId = :giataId "
+ "and se.secScope = 'MAINGALLERY' "
+ "and sp.category = 'MAINGALLERY' "
+ "and sp.seqOrder = 0")
GiataItem findPicture(@Param("giataId") String giataId);
}
SQL gives me the correct result for mine GiataItem. But I have no restrictions on my where clauses for all other mapped objects, such as service, sectionetc.
I use lazy loading, and its clarity, when I use giataIetem.getService, JPA makes a new choice, and my suggestions don't work there.
So, how can I make sure that all of my combined objects are built on where clauses and its limitations.