企业🤖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); } ```