I have two entities Contact/ContactEmail. Both has a partitionkey. When i update the contact entity, the generated query is incorrect. I am using Spring Boot 3.1.0 and Hibernate * 6.2.5. Final Fina*l
{noformat}Contact contact = salesContactRepository.findByIdAndAccountId(id, 2L).get(); contact.setFirstName("demo-2x"); Contact saved = salesContactRepository.save(salesContact);{noformat}
*Query generated*:
update contacts set first_name=? where id=? and account_id=? and account_id=?
*Exception*:
2023-06-26T15:37:09.802+05:30 ERROR 18627 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement [No value specified for parameter 4] [update contacts set first_name=? where id=? and account_id=? and account_id=?]; SQL [update contacts set first_name=? where id=? and account_id=? and account_id=?]] with root cause
I am able to replicate the issue with a valid testcase as well.
[https://github.com/hibernate/hibernate-test-case-templates/pull/282|https://github.com/hibernate/hibernate-test-case-templates/pull/282|smart-link] |
|