micronaut-projects / micronaut-data

Ahead of Time Data Repositories
Apache License 2.0
464 stars 195 forks source link

Regression in like queries between 4.8.5 and 4.9.0 #3093

Closed rlubke closed 4 weeks ago

rlubke commented 4 weeks ago

Expected Behavior

The following test and repository should yield results:

    @Test
    public void shouldGetBooksWithTitleLike() {
        assertThat(repo.findByTitleLike("%Dune%"), containsInAnyOrder(
                books.stream().filter(book -> book.getTitle().contains("Dune")).toArray()));
    }
/**
 * A {@link Book} {@code Repository} to test queries generated by Micronaut.
 */
@CoherenceRepository("book")
public interface BookRepository extends CrudRepository<Book, UUID> {
...

List<Book> findByTitleLike(String like);

...
}

Actual Behaviour

With 4.9.0, no results are returned.

What I've observed is that in 4.8.5 calling PreparedQuery.getQueryBindings (which we're using to build a map of parameters to feed to CohQL) returns a non-empty list (as expected), however, in 4.9.0 this value is always empty.

Steps To Reproduce

  1. Checkout the data-regression branch in https://github.com/micronaut-projects/micronaut-coherence
  2. Run test GeneratedStatementsTest.shouldGetBooksWithTitleLike

Code on the Coherence side calling PreparedQuery.getQueryBindings() is in DefaultCoherenceRepostoryOperations.createBindingMap()

Environment Information

Example Application

No response

Version

4.6.3

graemerocher commented 4 weeks ago

@radovanradic please take a look