query-validator icon indicating copy to clipboard operation
query-validator copied to clipboard

add spring data jpa @Query support

Open destan opened this issue 5 years ago • 7 comments

  • Adds support for queries in @Query annotation of Spring Data JPA.
  • Ignores the query when nativeQuery = true on the annotation
  • does not support (not check) countQuery on the annotation yet.

tried to follow the repository's coding style and conventions as much as I can but I can fix things if you point them on comments.

destan avatar Sep 04 '19 14:09 destan

Thanks, I'll review it properly soon, I promise!

gavinking avatar Sep 16 '19 17:09 gavinking

@destan do you think there's a way we could do this without adding a hard dependency to Spring?

I mean, in principle it's enough just to know the name of the annotation.

gavinking avatar Jan 14 '20 14:01 gavinking

spring dependencies are only required for tests, there is no hard spring dependency for the query-validator itself.

Normally spring dependencies should be test scoped build.gradle dependency entries however due to the implementation of the tests I had to put them into the lib folder.

is there anything I overlooked?

destan avatar Jan 16 '20 09:01 destan

spring dependencies are only required for tests

Sure, but I would prefer that this project didn't have a dependency to Spring.

gavinking avatar Jan 19 '20 15:01 gavinking

By the way, if you're worried about it breaking in tests, you could just add an annotation with the same name as the Spring @Query annotation to the test module.

gavinking avatar Jan 19 '20 15:01 gavinking

you could just add an annotation with the same name as the Spring @Query annotation to the test module

I didn't think of that in the first place, let me update the PR according to this approach and make it free of any spring dependencies.

destan avatar Jan 20 '20 12:01 destan

Great, thanks!

gavinking avatar Jan 20 '20 12:01 gavinking