'Spring Data JPA Derived Query Method for column value equals to another column value on the same entity
I have gone through Spring Data JPA docs, but couldn't find anything about what I'm asking here:
Is there any way to compare values of two different columns of same entity with each other in derived query method for the below simple query:
SELECT * FROM User user WHERE user.firstName=user.lastName
Solution 1:[1]
Unfortunately, Spring Data JPA does not have that functionality as of version 2.7.0
You can create a new issue on the public github repo and if the developers find it suitable (higher demand for the issue is a plus), it might be implemented in the future.
For now, possibly the best option for you is to use @Query annotation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gsan |
