Issue
I have 2 tables, salesOrder with column "id", "customerId", "textReview(boolean)" and table SalesOrderline with column "salesOrderId", "productId". i want to change boolean data in textReview column. I got data from the client in the form is customerId and productId.
Native Query SQL that I made like this.
update sales order set text_review = true where (select id from salesorder where customer_id = ?) in (select salesorder_id from salesorderline where product_id = ?)
Is the SQL query correct?
I'm confused how to execute this query using jpa or hibernate in spring boot.
Solution
In SQL should be something like:
update salesOrder
set text_review = true where customer_id = ?
and id in (select salesorder_id from salesorderline where product_id = ?)
In JPA I don't think you need the select statement.
Answered By - Vlad L
Answer Checked By - Willingham (JavaFixing Volunteer)