Reputation: 45
So I've read the Spring documentation that states that when you have property names with an underscore (first_name
) you should escape and underscore in a query method by using another underscore (findByFirst__name(...)
).
However, in practice this does not work and we get a runtime error stating that the property first
cannot be found. This has been documented by other devs here:
But none of the provided answers addresses the fact that this is not working properly in practice. Most answers state to remove the underscore from the property name.... which is not always an easy or possible task. Can anyone confirm that they actually have gotten this to work? My guess is that there is a bug in Spring-data but for some reason no one has acknowledged this or filed a bug yet.
Is there a workaround to this problem that anyone has had success with besides renaming the database field?
Upvotes: 1
Views: 2304
Reputation: 1701
I debugged the spring-data-commons 1.9.2.RELEASE version and created the following pull request since the code seems not to handle this case. For further information please review the following link:
https://github.com/spring-projects/spring-data-commons/pull/126
Read here: https://jira.spring.io/browse/DATACMNS-569
Upvotes: 1