Skip to content

Conversation

@thomasdarimont
Copy link
Contributor

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.
The example wrapper allows us to customize the parameter extraction / generation
from the provided prototype bean.

Would be great if we could unify this effort with the infrastructure
from DATAMONGO-1245.

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.
@thomasdarimont
Copy link
Contributor Author

Potential things to improve / think about are:

  • Provide a common shared Example wrapper in Spring Data Commons.
  • Support nested attribute paths for exclusion.
  • Consider an alternative style to express example predicates:
 userRepository.findByExample(new Example(){
    String name = "thomas";
    String countryCode = "de";
    Boolean tired = true;
});

//or perhaps

 userRepository.findByAttributes(new Attrbutes(){
    String name = "thomas";
    String countryCode = "de";
    boolean tired = true;
});
  • Provide query by example at CrudRepository level.

@ripper2hl
Copy link

Why no accept this pull request?, better approach ? , the querys by Example its a great feature 👍

@schauder
Copy link
Contributor

This is superseeded by #164

@schauder schauder closed this May 28, 2019
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.

3 participants