When I make an insert in db, I see this error: Illegal attempt to
associate a collection with two open session , and insert doesn't
work.
My insert is this:
public void InsertOrder(List<ProductBasket> products, Float total)
{
Session s = HibernateUtil.currentSession();
for (ProductBasket prodOrd : products) {
for (Product product : GetAllProducts()) {
if (prodOrd.getId().equals(product.getId())) {
OrderProduct orderProd = new
OrderProduct(prodOrd.getQuantity(), prodOrd.getColor(),
prodOrd.getSize());
orderProd.setOrder(new ShippingOrder(new Date(),
total, "open"));
orderProd.setProduct(product);
s.save(orderProd);
}
}
}
s.beginTransaction().commit();
}
I don't understand where is the problem.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.