floralee,
Thank you very much for your reply, I more than appreciate it!
Your sample code above is almost exactly how I am currently saving the object graph.
In my Controller in the onSubmit method:
Code:
Item item = (Item) command;
String[] paymentsTypesFromJsp= request.getParameterValues("paymentTypes");
Set paymentTypes = new HashSet();
for (int i = 0; i < paymentsTypesFromJsp.length; i++) {
ItemPaymentTypeId itemPaymentTypeId = new ItemPaymentTypeId ();
itemPaymentTypeId.setPaymentTypeId(new Integer(paymentsTypesFromJsp[i]));
//itemPaymentTypeId.setItemId(IdoNotHaveThisValue);
ItemPaymentType itemPaymentType = new ItemPaymentType();
itemPaymentType.setId(itemPaymentTypeId);
itemPaymentType.setItem(item);
paymentTypes.add(itemPaymentType);
}
item.setPaymentTypes(paymentTypes);
itemService.saveOrUpdate(item);
The Service layer then calls through to the Hibernate Item DAO:
Code:
getHibernateTemplate.saveOrUpdate(item);
Also, I do not have a separate DAO for ItemPaymentType.
The error that I'm receiving is something like this:
"Hibernate could not execute batch update because item_id cannot be null" - referencing the item_id in the ItemPaymentTypeId object, which I cannot set b/c I do not have this value when building out the object graph.
Again, thanks for any help, I more than appreciate it - this one has me stumped!
Thanks,
Matt