I'm new in Java Language and now I have a small project, but I'm stuck.
I want to select data from Permission table with where option.
I have to create query in PermissionRepository like this
@Repository
public interface PermissionRepository extends JpaRepository<Permission, Long> {
    @Query(value = "SELECT * FROM permissions WHERE role_id = ?1", nativeQuery = true)
    List<Permission> findPermissionByRoleId(Long role_id);
}
And I call it in the controller like this
@GetMapping(value = "/secure/roles/edit/{id}")
public ModelAndView editRole(@PathVariable(value = "id") Long id, @Valid Role role) {
    ModelAndView modelAndView = new ModelAndView();
        
    try {
        Role roles = roleService.getRoleById(id);
        List<Permission> p = permissionRepository.findPermissionByRoleId(id);
        System.out.println(p);
            
        modelAndView.setViewName("/secure/master/role/edit");
    } catch (MessageNotFoundExeptions e) {
        e.printStackTrace();
        modelAndView.addObject("message", e.getMessage());
        modelAndView.setViewName("/secure/master/role/edit");
    }
      return modelAndView;
}
Anyone can help me fix this error? Thanks

 
     
    