i came cross this problem too! anyone has a good idea to solve it?
BTW, i use Struts2+Spring2+Hibernate3.
Spring takes charge of the Struts Action(scope="prototype") and Hibernate session/transaction.
I tried this: dynamic-update="true", but the setting is useless.
i've been seeking for long and got one solution:
load an object before you update it. (it means if you wanna modify an object, you'll have to load it for two times, and then saveOrUpdate it at last)...but i think it's not that good. Especially, we have to set all the properties by hand....oh, god. .what if the object is big enough as the earth?
i've been looking for a better way for 2 days...what makes me confused, what does the property "dynamic-update" use for???...
Especially, we have to set all the properties by hand....oh, god. .what if the object is big enough as the earth?
Doesn't loading it before updating fix this? Why do you need to set properties by hand? Just set those you are updating.
i use getHibernateTemplae().load(XXX.class, id) to load an object, then modify it in a form, and submit.
the property scope="prototype" in applicationContext.xml.
saveOrUpdate(obj). If there is not hidden property "id" in the form, "save(obj)" would be called. If there is a hidden property "id", "update(obj)" would be called, but those properties didn't need to change and i didn't modified is null....
so i have to load the object once again and set all the properties by hand, cuz i just need to modify some properties in different situation.
i am sorry for my poor english , i just can't express it out, though it might be just a very simple problem.
anyways, thank you, Paul
subject: Hibernate update when Object isn't modified