搭建环境 n 同时下载 Spring Data Commons 和 Spring Data JPA 两个发布包: Commons 是 Spring Data 的基础包 然后配置application. Context. xml
Repository 接口
Spring. Data 方法定义规范
索引参数与命名参数 n 如果是 @Query 中有 LIKE 关键字,后面的参数需要前面 或者后面加 %,这样在传递参数值的时候就可以不加 %: @Query("select o from User. Model o where o. name like ? 1%") public List<User. Model> find. By. Uuid. Or. Age(String name); @Query("select o from User. Model o where o. name like %? 1%") public List<User. Model> find. By. Uuid. Or. Age(String name);