I am writing a native query that collects data from several tables. I also need pageable and sort by alliances. Unfortunately, Sort "sticks" immediately the address of the first table that has no given alliance. Is it possible to dynamically sort and also page? I tried to pass a String with a name followed by "order by", but hibernate ignores it.
@Query(value = "SELECT pt.id as id, pt.work as workplace ,bo.virtualName as title, bo.creationDate as date FROM t_projecttemplate pt JOIN t_objecttowork ot on pt.id=ot.id JOIN t_objectplus bo on ot.id=bo.id where bo.deleted=false and bo.parent_id=?1", nativeQuery = true)
List<Map<String,Object>> getObjects (Long parentId, Pageable pageable); //want to sort by title, hibernate sticks immediately "pt."