This is related to my previous post. I’m getting errors when adding children to Customer. I’ve fixed them, but should I have to? I reported these issues before the GA.
Here is my fix (I commented out the unnecessary lines) At least I think they are necessary, and, in fact, cause the error. The first store of sapcustsalesarea fails due to a null sapCustomer. As I said, this is the same problem I reported weeks ago.
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
public SapCustomer saveSapCustomerSapCustSalesarea(String customerNum, SapCustSalesarea sapcustsalesarea) {
SapCustomer sapcustomer = sapCustomerDAO.findSapCustomerByPrimaryKey(customerNum, -1, -1);
//sapcustsalesarea = sapCustSalesareaDAO.store(sapcustsalesarea);
//sapCustSalesareaDAO.flush();
sapcustsalesarea.setSapCustomer(sapcustomer);
//sapcustomer.getSapCustSalesareas().add(sapcustsalesarea);
sapcustsalesarea = sapCustSalesareaDAO.store(sapcustsalesarea);
sapCustSalesareaDAO.flush();
//sapcustomer = sapCustomerDAO.store(sapcustomer);
//sapCustomerDAO.flush();
return sapcustomer;
}