Skip to content

Commit d04e5aa

Browse files
committed
[Wen Hao] - update README.
1 parent 51051ee commit d04e5aa

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
# jpa-spec
44

5+
### Features
6+
7+
* Compatible with JPA 2 interface.
8+
* Equal/NotEqual/Like support multiple values, Equal/NotEqual support **Null** value.
9+
* Builder style specification creator.
10+
11+
12+
### JPA 2 criteria API introduction
13+
514
JPA 2 introduces a criteria API that can be used to build queries programmatically.
615

716
Writing a criteria you actually define the where-clause of a query for a domain class.
@@ -32,7 +41,7 @@ repositories {
3241
}
3342
3443
dependencies {
35-
compile 'com.github.wenhao:jpa-spec:2.0.6'
44+
compile 'com.github.wenhao:jpa-spec:2.0.7'
3645
}
3746
```
3847

@@ -44,7 +53,7 @@ add repository [http://jcenter.bintray.com](http://jcenter.bintray.com) to maven
4453
<dependency>
4554
<groupId>com.github.wenhao</groupId>
4655
<artifactId>jpa-spec</artifactId>
47-
<version>2.0.6</version>
56+
<version>2.0.7</version>
4857
</dependency>
4958
```
5059

@@ -76,7 +85,7 @@ Specification<Person> specification = new Specifications<Person>()
7685
.like("nickName", "%og", "%me")
7786
.build();
7887

79-
personRepository.findAll(specification, new PageRequest(0, 15));
88+
Page<Person> persons = personRepository.findAll(specification, new PageRequest(0, 15));
8089
```
8190

8291
####Equal/NotEqual Example
@@ -107,7 +116,7 @@ Specification<Person> specification = new Specifications<Person>()
107116
.gt(Objects.nonNull(person.getAge()), "age", 18)
108117
.build();
109118

110-
personRepository.findAll(specification, new PageRequest(0, 15));
119+
Page<Person> persons = personRepository.findAll(specification, new PageRequest(0, 15));
111120
```
112121

113122
####Between Example
@@ -139,5 +148,6 @@ Specification<Person> specification = new Specifications<Person>()
139148

140149
Sort sort = new Sort(new Order(DESC, "name"), new Order(ASC, "birthday"));
141150

142-
personRepository.findAll(specification, new PageRequest(0, 15, sort));
151+
Page<Person> persons = personRepository.findAll(specification, new PageRequest(0, 15, sort));
152+
long totalCount = personRepository.count(specification);
143153
```

0 commit comments

Comments
 (0)