What I'm trying to do is when the customer order a product the order will be save to the DB and that product will be updated.
Session session = factory.openSession();
Transaction t = session.beginTransaction();
try {
session.update(product);
session.save(order);
t.commit();
}
catch (Exception e) {
t.rollback();
}
finally {
session.close();
}
The product and the order are 2 different object type. I got no exception when running this code but only the product got updated, the order was not saved.
Sorry for my bad English.