Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity being demanded an exists property which seems related to QueryByExampleExecutor [DATAJDBC-617] #837

Closed
spring-projects-issues opened this issue Oct 16, 2020 · 5 comments
Assignees
Labels
in: repository status: declined type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 16, 2020

Jesús Platas Varet opened DATAJDBC-617 and commented

Please bear with me if this is not a bug. We had this working in 1.0.19 and checked the documentation for the migration. We might been missed something.

We have been upgrading projects to the last Spring Boot version, which includes 2.0.4 of SD-JDBC. Several component tests are now failing when loading the context:

 

Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract boolean org.springframework.data.repository.query.QueryByExampleExecutor.exists(org.springframework.data.domain.Example)! Reason: No property exists found for type ClienteEntity!

 

I'm attaching an example with a component test that shows this. The weird project structure is because our component is an starter and the classes in the demo package are supposed for test only and not to be delivered in the final jar.

 

Tried so far:

  • I've seen several Stack Overflow posts refering to issues related with naming of properties and methods which can make Data to miss something. I have not found anything incoherent.
  • Other solutions make use of the addition of methods in the service and repository with a @Query-annotated method and a service doing and invocation passing an Example instance (although we don't need to use them). The behaviour is the same.
  • Also some debugging in the points shown in the stacktrace. Nothing has picked my attention.

 

If this is not really a bug, please provide links to the docs that explain this part of the configuration. Thx.

 


Affects: 2.0.4 (Neumann SR4)

Attachments:

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 16, 2020

Jens Schauder commented

The problem is that you are extending QueryByExampleExecutor.

It is not supported by Spring Data JDBC which in the previous version probably went unnoticed because we didn't check if for all method an implementation could be provided.

We now support query derivation.
Since the methods of QueryByExampleExecutor aren't provided in any other way, query derivation kicks in and tries to derive a query from the method names, which fails.

Since you aren't actually using QueryByExampleExecutor just removing it from the extends list of your repository should solve that problem

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 16, 2020

Jens Schauder commented

Please confirm that this solves your problem

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 19, 2020

Jesús Platas Varet commented

Hi Jens,

Thanks for your feedback. Though no test is provided, there is a method findAllByIdAndNombreAndApellidos in ClienteService which will not work if we remove the interface QueryByExampleExecutor as it's making use of Example instances. I see that I mentioned something earlier (invocation passing an Example instance (although we don't need to use them)) which may be misleading. I was referring to the exists() method, which we don't use.

Could we expect to have this supported in the future?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 20, 2020

Jens Schauder commented

That is ... interesting ... because as said, Spring Data JDBC currently does not support Query-By-Example and never has.

I can't start your example project, due to broken dependencies, and I really don't want to try because it is mostly stuff completely unrelated to the issue.

But if you can provide a bare bone example, i.e without web stuff and with a properly configured in memory database, demonstrating the use of Query-By-Example I'm eager to look into it

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 20, 2020

Jesús Platas Varet commented

I realised that I might have misled you. We assumed that this functionality was suported as in JPA.

Please close this. Thanks for your time.

 

@spring-projects-issues spring-projects-issues added type: bug status: declined in: repository labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository status: declined type: bug
Projects
None yet
Development

No branches or pull requests

2 participants