Open jackmew opened 9 years ago
You can create concrete repositories by creating repository interfaces and letting Spring Data JPA do all the heavy lifting.
Spring Data JPA Tutorial
using Hibernate as your JPA provider
jpaRepository : List<?> findAll()
so , I choose to extends jpaRepository .
CrudRepository
PagingAndSortingRepository
JpaRepository
link
According to method Name and transform to sql query.
function name mapping
Code some sql query to Entity .
corresponding repository
It's a special way to do query , but maybe it's not practical.
Using this way can do a lot of elastic way to query .
I think 1 , 3 is enough.
Next goal is : like and date.
Spring Data JPA
You can create concrete repositories by creating repository interfaces and letting Spring Data JPA do all the heavy lifting.
Spring Data JPA Tutorial
using Hibernate as your JPA provider
jpaRepository : List<?> findAll()
so , I choose to extends jpaRepository .
CrudRepository
PagingAndSortingRepository
JpaRepository
Spring Data JPA - three types of Query
link
1. Query Creation from Method Name
According to method Name and transform to sql query.
function name mapping
2. JPA Named Queries
Code some sql query to Entity .
corresponding repository
It's a special way to do query , but maybe it's not practical.
3. @Query Annotation
Using this way can do a lot of elastic way to query .
I think 1 , 3 is enough.
Next goal is : like and date.