ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
`@Query`注解支持通过将`nativeQuery`标志设置为`true`来执行原生查询,同样支持基于位置的参数绑定及命名参数。原生查询就是使用数据库的 SQL 语句查询。 ```java public interface UserRepository extends JpaRepository<User, Integer> , JpaSpecificationExecutor<User> { @Query(value = "select * from user u where u.email = ?1", nativeQuery = true) User queryByEmail(String email); @Query(value = "select * from user u where u.email = :email", nativeQuery = true) User queryByEmail2(@Param("email") String email); } ```