Skip to content

DATAJPA-218 - Add support for Query By Example. #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from

Conversation

christophstrobl
Copy link
Member

We now support querying entities by providing a sample of the given object holding compare values.
At this time only SingularAttributes are considered and the given sample object must not contain cycles.

Example<Person> example = newExampleOf(new Person("dAVe", "Matth"))
    .matchStringsStartingWith()
    .matchStringsWithIgnoreCase()
    .get();

Page<Person> page = repository.findAllByExample(example, new PageRequest(0, 10));

By default null values will be ignored nevertheless using NullHandler.INCLUDE will match those using isNull.

It is possible to ignore properties based on their property path from Root.


Requires: spring-projects/spring-data-commons#153 (DATACMNS-810)
Supersedes: #150

thomasdarimont and others added 4 commits January 28, 2016 14:24
Added prototypic support for query by example queries to
SimpleJpaRepositories. Clients can use an Example Object to
wrap an existing prototype entity instance that will be used to
derive a query from.

Would be great if we could unify this effort with the infrastructure
from DATAMONGO-1245.
We convert a given Example to a set of and combinded Predicates using CriteriaBuilder.
Cycles within associations are not allowed and result in an InvalidDataAccessApiUsageException.
At this time only SingularAttributes are taken into concern.
@odrotbohm odrotbohm force-pushed the master branch 2 times, most recently from 6f08432 to bed0667 Compare January 28, 2016 14:21
Adopt changes from query by example API refactoring.

Related ticket: DATACMNS-810.
@mp911de mp911de force-pushed the issue/DATAJPA-218 branch from e63034c to 9828c19 Compare March 1, 2016 16:44
odrotbohm pushed a commit that referenced this pull request Mar 17, 2016
Added prototypic support for query by example queries to
SimpleJpaRepositories. Clients can use an Example object to
wrap an existing prototype entity instance that will be used to
derive a query from.

Related tickets: DATACMNS-810.
Original pull request: #164.
odrotbohm pushed a commit that referenced this pull request Mar 17, 2016
We convert a given Example to a set of and combined Predicates using CriteriaBuilder. Cycles within associations are not allowed and result in an InvalidDataAccessApiUsageException. At this time only SingularAttributes are taken into concern. Switched to types used in DATACMNS-810.

Related tickets: DATACMNS-810.
Original pull request: #164.
odrotbohm pushed a commit that referenced this pull request Mar 17, 2016
Add reference documentation. Adapted to API changes in Spring Data Commons.

Related tickets: DATACMNS-810.
Original pull request: #164.
odrotbohm added a commit that referenced this pull request Mar 17, 2016
Adapted to API changes in Spring Data Commons.

Related tickets: DATACMNS-810.
Original pull request: #164.
@odrotbohm odrotbohm closed this Mar 17, 2016
@odrotbohm odrotbohm deleted the issue/DATAJPA-218 branch March 17, 2016 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants