Skip to content

Commit

Permalink
[Wen Hao] - support spring-data-jpa version 2.0.5.RELEASE.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhao committed Mar 16, 2018
1 parent 590c0a1 commit 3fe89b0
Show file tree
Hide file tree
Showing 20 changed files with 898 additions and 70 deletions.
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ English Version:

[Latest]

[3.2.0]

[3.1.0]

[3.0.0]
Expand All @@ -29,6 +31,8 @@ Chinese Version:

[最新]

[3.2.0_cn]

[3.1.0_cn]

[3.0.0_cn]
Expand All @@ -41,7 +45,7 @@ repositories {
}
dependencies {
compile 'com.github.wenhao:jpa-spec:3.1.1'
compile 'com.github.wenhao:jpa-spec:3.2.0'
}
```

Expand All @@ -51,7 +55,7 @@ dependencies {
<dependency>
<groupId>com.github.wenhao</groupId>
<artifactId>jpa-spec</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
</dependency>
```

Expand All @@ -77,7 +81,7 @@ public Page<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.eq(StringUtils.isNotBlank(request.getName()), "name", request.getName())
.gt(Objects.nonNull(request.getAge()), "age", 18)
.between("birthday", new Range<>(new Date(), new Date()))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.like("nickName", "%og%", "%me")
.build();

Expand Down Expand Up @@ -146,8 +150,8 @@ find any person age between 18 and 25, birthday between someday and someday.
```java
public List<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.between(Objects.nonNull(request.getAge(), "age", new Range<>(18, 25))
.between("birthday", new Range<>(new Date(), new Date()))
.between(Objects.nonNull(request.getAge(), "age", Range.of(inclusive(18), inclusive(25)))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.build();

return personRepository.findAll(specification);
Expand Down Expand Up @@ -232,7 +236,7 @@ public List<Phone> findAll(SearchRequest request) {
```java
public List<Phone> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.between("age", new Range<>(10, 35))
.between("age", Range.of(inclusive(10), inclusive(35)))
.eq(StringUtils.isNotBlank(jack.getName()), "addresses.street", "Chengdu")
.build();

Expand Down Expand Up @@ -269,7 +273,7 @@ public List<Phone> findAll(SearchRequest request) {
```java
public List<Phone> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.between("age", new Range<>(10, 35))
.between("age", Range.of(inclusive(10), inclusive(35)))
.predicate(StringUtils.isNotBlank(jack.getName()), ((root, query, cb) -> {
Join address = root.join("addresses", JoinType.LEFT);
return cb.equal(address.get("street"), "Chengdu");
Expand All @@ -289,7 +293,7 @@ public List<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.eq(StringUtils.isNotBlank(request.getName()), "name", request.getName())
.gt("age", 18)
.between("birthday", new Range<>(new Date(), new Date()))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.like("nickName", "%og%")
.build();

Expand All @@ -311,7 +315,7 @@ public Page<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.eq(StringUtils.isNotBlank(request.getName()), "name", request.getName())
.gt("age", 18)
.between("birthday", new Range<>(new Date(), new Date()))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.like("nickName", "%og%")
.build();

Expand Down Expand Up @@ -370,15 +374,17 @@ Alternatively, using virtual view and give a readable/significant class name to

### Copyright and license

Copyright © 2016-2017 Wen Hao
Copyright © 2016-2018 Wen Hao

Licensed under [Apache License]


[Latest]: ./docs/3.1.1.md
[Latest]: ./docs/3.2.1.md
[3.2.0]: ./docs/3.2.0.md
[3.1.0]: ./docs/3.1.0.md
[3.0.0]: ./docs/3.0.0.md
[最新]: ./docs/3.1.1_cn.md
[最新]: ./docs/3.2.0_cn.md
[3.2.0_cn]: ./docs/3.2.0_cn.md
[3.1.0_cn]: ./docs/3.1.0_cn.md
[3.0.0_cn]: ./docs/3.0.0_cn.md
[Legacy Hibernate Criteria Queries]: https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#appendix-legacy-criteria
Expand Down
22 changes: 11 additions & 11 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repositories {
}
dependencies {
compile 'com.github.wenhao:jpa-spec:3.1.1'
compile 'com.github.wenhao:jpa-spec:3.2.0'
}
```

Expand All @@ -49,7 +49,7 @@ dependencies {
<dependency>
<groupId>com.github.wenhao</groupId>
<artifactId>jpa-spec</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
</dependency>
```

Expand All @@ -59,7 +59,7 @@ dependencies {
<dependency>
<groupId>com.github.wenhao</groupId>
<artifactId>jpa-spec</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>org.hibernate.javax.persistence</groupId>
Expand Down Expand Up @@ -116,7 +116,7 @@ public Page<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.eq(StringUtils.isNotBlank(request.getName()), "name", request.getName())
.gt(Objects.nonNull(request.getAge()), "age", 18)
.between("birthday", new Range<>(new Date(), new Date()))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.like("nickName", "%og%", "%me")
.build();

Expand Down Expand Up @@ -212,8 +212,8 @@ find any person age between 18 and 25, birthday between someday and someday.
```java
public List<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.between(Objects.nonNull(request.getAge(), "age", new Range<>(18, 25))
.between("birthday", new Range<>(new Date(), new Date()))
.between(Objects.nonNull(request.getAge(), "age", Range.of(inclusive(18), inclusive(25)))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.build();

return personRepository.findAll(specification);
Expand Down Expand Up @@ -330,7 +330,7 @@ public List<Phone> findAll(SearchRequest request) {
```java
public List<Phone> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.between("age", new Range<>(10, 35))
.between("age", Range.of(inclusive(10), inclusive(35)))
.eq(StringUtils.isNotBlank(jack.getName()), "addresses.street", "Chengdu")
.build();

Expand Down Expand Up @@ -379,7 +379,7 @@ public List<Phone> findAll(SearchRequest request) {
```java
public List<Phone> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.between("age", new Range<>(10, 35))
.between("age", Range.of(inclusive(10), inclusive(35)))
.predicate(StringUtils.isNotBlank(jack.getName()), ((root, query, cb) -> {
Join address = root.join("addresses", JoinType.LEFT);
return cb.equal(address.get("street"), "Chengdu");
Expand All @@ -402,7 +402,7 @@ public List<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.eq(StringUtils.isNotBlank(request.getName()), "name", request.getName())
.gt("age", 18)
.between("birthday", new Range<>(new Date(), new Date()))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.like("nickName", "%og%")
.build();

Expand Down Expand Up @@ -430,7 +430,7 @@ public Page<Person> findAll(SearchRequest request) {
Specification<Person> specification = Specifications.<Person>and()
.eq(StringUtils.isNotBlank(request.getName()), "name", request.getName())
.gt("age", 18)
.between("birthday", new Range<>(new Date(), new Date()))
.between("birthday", Range.of(inclusive(new Date()), inclusive(new Date())))
.like("nickName", "%og%")
.build();

Expand Down Expand Up @@ -508,7 +508,7 @@ Spring Data JPA对投射、分组和聚合支持不是很好,

### Copyright and license

Copyright © 2016-2017 Wen Hao
Copyright © 2016-2018 Wen Hao

Licensed under [Apache License]

Expand Down
15 changes: 5 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repositories {
}

group = 'com.github.wenhao'
version = '3.1.1'
version = '3.2.0'

idea {
project {
Expand Down Expand Up @@ -119,7 +119,7 @@ publishing {
artifact javadocJar
groupId 'com.github.wenhao'
artifactId 'jpa-spec'
version '3.1.1'
version '3.2.0'
pom.withXml {
def root = asNode()
root.appendNode('description', 'A JAP Query By Specification framework.')
Expand Down Expand Up @@ -154,10 +154,10 @@ bintray {
githubRepo = 'wenhao/jpa-spec'
githubReleaseNotesFile = 'README.md'
version {
name = '3.1.1'
desc = 'A JAP Query By Specification framework 3.1.1'
name = '3.2.0'
desc = 'A JAP Query By Specification framework 3.2.0'
released = new Date()
vcsTag = '3.1.1'
vcsTag = '3.2.0'
gpg {
sign = true
passphrase = 'passphrase'
Expand All @@ -170,9 +170,4 @@ bintray {
}
}
}
}


wrapper {
gradleVersion = '4.1'
}
Loading

0 comments on commit 3fe89b0

Please sign in to comment.