Skip to content
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

Infer example criateria fields automatically #45

Closed
rmpestano opened this issue Oct 3, 2019 · 0 comments
Closed

Infer example criateria fields automatically #45

rmpestano opened this issue Oct 3, 2019 · 0 comments
Milestone

Comments

@rmpestano
Copy link
Contributor

rmpestano commented Oct 3, 2019

Issue Overview

Currently we need to explicit pass which attributes will be used in example criteria.

It would be nice if those fields could be inferredautomatically based on which fields are not null.

Current Behaviour
Car carExample = new Car().model("Ferrari");
        List<Car> cars = crudService.example(carExample, Car_.model).getResultList();
        assertThat(cars).isNotNull().hasSize(1)
            .extracting("model")
            .contains("Ferrari");

        carExample = new Car().model("porche").name("%avenger");
        cars = crudService.exampleLike(carExample, Car_.name, Car_.model).getResultList();

        assertThat(cars).isNotNull().hasSize(1)
            .extracting("name")
            .contains("porche avenger");

Note that metamodel attributes are explicity passed as parameters to the example method.

Expected Behaviour
Car carExample =  new Car().model("porche").name("%avenger");
        List<Car> cars = crudService.exampleLike(carExample).getResultList();
        assertThat(cars).isNotNull().hasSize(1)
            .extracting("name")
            .contains("porche avenger");
Additional Information
  • Affected version: 1.0.7
@rmpestano rmpestano added this to the 1.1.0 milestone Oct 3, 2019
rmpestano pushed a commit that referenced this issue Oct 3, 2019
@rmpestano rmpestano changed the title Automatic infer example criateria fields automatically Infer example criateria fields automatically Oct 4, 2019
@rmpestano rmpestano changed the title Infer example criateria fields automatically Infer example criateria fields automatically Oct 4, 2019
@rmpestano rmpestano changed the title Infer example criateria fields automatically Infer example criateria fields automatically Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant