micronaut-projects / micronaut-data

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

Cannot query pageable with join criteria #3052

Closed radovanradic closed 1 month ago

radovanradic commented 1 month ago

Expected Behavior

Having Author and Book mapping entities, and relation in Author

@OneToMany(cascade = CascadeType.ALL, mappedBy = "author")
    private Set<Book> books = new HashSet<>();

Defining such query on Author repository should work.

@Join(value = "books", type = Join.Type.LEFT_FETCH)
    CursoredPage<Author> findByBooksTotalPages(int totalPages, CursoredPageable pageable);

Actual Behaviour

Compile error is thrown telling it is Unable to implement Repository method: with the error Property is not joined at path: books

This is regression from https://github.com/micronaut-projects/micronaut-data/issues/1882 that was release in micronaut-data 3.9.0 and that code change should be reverted.

Steps To Reproduce

Explained in expected behavior section.

Environment Information

Any

Example Application

No response

Version

micronaut-data since 3.9.0