Thứ Ba, 31 tháng 5, 2016

Spring Data JPA: @Query Annotation

I create simple JpaRepository with @Query Annotation.

But, it throws an exception:

Caused by: java.lang.IllegalArgumentException: Validation failed for query for method

Fix: with link http://javabeat.net/spring-data-jpa-query/
Like that, add nativeQuery = true
@Query(value = "select * from #{#entityName} b where b.name=?1", nativeQuery = true) List<Book> findByName(String name);


- Comments

0 nhận xét:

Đăng nhận xét