PDA

View Full Version : Avoiding unneeded updates



thomasvdv
Aug 20th, 2004, 11:14 AM
Hello,

I am using Hibernate with Spring in a web form based application. When users browse through a form (clicking "next" or "back"), and they do not make changes to the fom data, I want to avoid an update statement from being executed on data that has not been changed. Is there any way to avoid these unneeded updates?

Thanks.

Colin Sampaleanu
Aug 20th, 2004, 11:20 AM
Well, you can set your transactions to readonly if you know you will not be updating the data. In that case, the commit and flush would not be called.

Take a look at the Transaction section of the Spring manual for info on doing this.

Regards,

thomasvdv
Aug 20th, 2004, 11:28 AM
The problem is that you do not know if the user has changed data. For those pages where he made a change you want to issue an update, for those that he left unchanged, you want to do nothing.