micronaut-projects/micronaut-data

Overriding findAll() results in exception

Closed this issue · 7 comments

Expected Behavior

This should work:

	@Override
	@NonNull
	List<Genre> findAll();

Actual Behaviour

An exception is thrown:

java.lang.IllegalStateException: Micronaut Data method is missing compilation time query information. Ensure that the Micronaut Data annotation processors are declared in your build and try again with a clean re-build.
	at io.micronaut.data.runtime.intercept.DataInterceptorResolver.findDataInterceptor(DataInterceptorResolver.java:111)
	at io.micronaut.data.runtime.intercept.DataInterceptorResolver.resolve(DataInterceptorResolver.java:77)
	at io.micronaut.data.runtime.intercept.DataIntroductionAdvice.intercept(DataIntroductionAdvice.java:75)
	at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:138)
	at com.kingfishertom.snobs.repository.GenreRepository$Intercepted.findAll(Unknown Source)

Steps To Reproduce

All other repositories in the project work as expected. All other methods in this repository work as expected: I am able to override findById(), etc. So this is not an "annotation processors are declared" issue as the exception suggests.

When I do not override findAll(), it also works, but I need to override it so I can add @Join annotation.

Environment Information

No response

Example Application

No response

Version

4.5.0

Please attach a sample project that is reproducing it

This is a project to demo the issue:

https://github.com/volgin/snobs-bug-demo.git

Note that findById test works, while findAll test fails.

I am not getting compilation errors and the tests are passing (I just adjusted connection to my local db and disabled that listener which can't use locally, not sure what it is doing).

Is it failing when run using maven or just from IDE?

  1. I was using IDE. When I tried mvn clean verify and mvn test, all tests passed. Even more curiously, now when I run tests in Eclipse, they also pass.

I have not thought of trying maven, because in a real project there many more repositories and tests, and all tests were working except for this one. Something prevented Micronaut from precompiling just this one query.

  1. I went to the original project and tried this test again in Eclipse. In failed. Then I tried mvn test. It failed.

mvn clean verify worked. After mvn clean verify, both mvn test and Eclipse test work.

This is really strange, because I did try to clean the project using Eclipse, but it did not solve the problem.

It looks like some IDE problems unrelated to Micronaut

we recommend either IntelliJ or VScode