darrachequesne / spring-data-jpa-datatables

Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
Apache License 2.0
447 stars 173 forks source link

Custom query #53

Closed Dazzel closed 7 years ago

Dazzel commented 7 years ago

Is it possible to support the @Query annotation? Or even better, to allow custom repository methods with this?

I am trying to get something like this working:

DataTablesOutput<Entity> findAllBySearch(SearchEntity search, DataTablesInput input);

Or with @Query:

@Query("select e from entites where e.search = ?1")
DataTablesOutput<Entity> findAllBySearch(SearchEntity search, DataTablesInput input);

So search is an attribute of entity and I try to filter all entities by an search value.

I know, I can do this by Specifications or QueryDSL but does it work with normal spring repositories?

This behaviour would correlate with the default respoitories, like Page<Entity> findAllBySearch(SearchEntity search, Pageable pageble)

darrachequesne commented 7 years ago

I don't think it is possible, as there is a bit of dark magic happening with Page<Entity> findAllBySearch(SearchEntity search, Pageable pageable).

Do you have a given use case where a Specification would not work?

Dazzel commented 7 years ago

I do not have any use case where specifications do not work. I was just wondering if it would possible to get it working without it because it is much more intuitive using the repository methods or the query annotations.

But I appreciate your fast anweser 😊

Damien Arrachequesne notifications@github.com schrieb am Mi., 15. März 2017, 22:22:

I don't think it is possible, as there is a bit of dark magic happening with Page findAllBySearch(SearchEntity search, Pageable pageable).

Do you have a given use case where a Specification would not work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/darrachequesne/spring-data-jpa-datatables/issues/53#issuecomment-286883455, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7W2C_7qp3NQ2f0ybdFo07rGk-YZHotks5rmFZ7gaJpZM4MeLWj .