jpa number / digit placeholder? 1 /? 2

Here the reference nodeId corresponding place holder 1, corresponding to the severity parameter 2;?? Disadvantage is that the serial number must be sequential order corresponds exactly Parametric

@Modifying
@Transactional
@Query(value = "delete from warning_detail where node_id=?1 and severity=?2")
int deleteByNodeIdAndSeverity(String nodeId, String severity);

============= standard naming ===============

 // 根据名字进行精准查询,Standard类中有name字段
 User findByName(String name);
 // 根据名字进行模糊查询
 User findByNameLike(String name);
 // 查询名字为空的数据
 List<User> findByNameIsNull();
 // 多条件查询
 User findByNameAndPassword(String name,String password);

============== non-standard naming =============

 // 使用JPQL进行非标准命名查询
 @Query("from User u where u.name like ?")
 User findByNamexxxxxLikeJPQL(String name);
 // 使用JPQL进行非标准多条件查询
 // 默认情况下,问号的顺序和传入的参数顺序是一致的
 // 可以在问号后面追加数字,改变和参数的匹配顺序
 // 下面的示例中,传入的第一个参数匹配到第二个问号,传入的第二个参数匹配到第一个问号
 @Query("from User u where u.name like ?2 and password = ?1")
 User findByNameAndOperatorJPQL(String password,String name);
 // 使用标准SQL进行非标准命名查询
 @Query(value = "select * from user u where u.name like ?", nativeQuery = true)
 User findByNamexxxxxLikeSQL(String name);

Guess you like

Origin www.cnblogs.com/shengulong/p/11546700.html