CustomerPasswordHistory Table
| Id | CustomerId | PasswordChangeBy |
|---|---|---|
| 1 | 1182 | ABC |
| 2 | 1182 | CDE |
Customer Table
| Id | firstName | userIdentity |
|---|---|---|
| 1182 | XYZ | 01231923123 |
| 2345 | asda | 12093109231 |
Expected Outcome
| FirstName | PasswordchangeBy | userIdentity |
|---|---|---|
| XYZ | ABC | 01231923123 |
| 2345 | asda | 12093109231 |
How to find expected outcome using java native query
@Query(value = "select c.first_name, cph.password_change_by, c.user_identity from wallet_db.customer.customer_password_history cph " +
"inner join wallet_db.customer.customer c on cph.customer_id = c.id ", nativeQuery = true)
if run this query java throw unique value exception