How to Pass Parameters in @Query

Passing parameters to an SQL query written via @Query can be done via @Param or via positional parameters:

// via @[email protected](value = "SELECT p FROM Product p WHERE p.department=:department")List fetchByDepartment(@Param("department") String department);// via positional [email protected](value = "SELECT p FROM Product p WHERE p.department=?1")List fetchByDepartment(String department);
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: