Problem in Handling Unit of work using Hibernate JPA
I use Spring + Hibernate + JPA I need to handle the list of customers by inserting their orders. Here is the Unit of work : for(Customer customer: CustomerList) { List<Order> orderList = customer.getOrders(); for(Order order: OrderList) { //1. Insert order into ORDER table //If insert fails due to Duplicate key then no rollback and I follow steps 2 & 3. //If insert fails due to any reason except duplicate key then rollback all the previous transactions //2. select the order record (If any issue during selection then rollbackall the previous transactions) //3. Update the order If status of the