How to Compare database record before UPDATE using iBatis?

2009-03-31 Thread Jasmin Mehta
I thought the Subject line of my question earlier was kind of misleading. Here is the same question with suitable subject line. From: Jasmin Mehta jasmin_me...@nexweb.org To: user-java@ibatis.apache.org Date: 03/31/2009 07:50 AM Subject: Check database before INSERT in iBatis Hi, I have

Re: How to Compare database record before UPDATE using iBatis?

2009-03-31 Thread Richard Yee
Why don't you override the Object.hashcode() method on your VO and call it and save the value when you retrieve the record. Call it again when the user submits their changes. If the values are different, the a change was made. -Richard Sent from my iPhone On Mar 31, 2009, at 4:54

Re: How to Compare database record before UPDATE using iBatis?

2009-03-31 Thread Nicholoz Koka Kiknadze
No I think. iBatis is not aware whether your VO-s have changed and can not decide whther to run updates or not. Why don't you override the Object.hashcode() method on your VO and call it and save the value when you retrieve the record. Call it again when the user submits their

Re: How to Compare database record before UPDATE using iBatis?

2009-03-31 Thread Jasmin Mehta
to Compare database record before UPDATE using iBatis? Why don't you override the Object.hashcode() method on your VO and call it and save the value when you retrieve the record. Call it again when the user submits their changes. If the values are different, the a change was made. -Richard

Re: How to Compare database record before UPDATE using iBatis?

2009-03-31 Thread Richard Yee
If you override equals, you have to have two VO objects to do the comparison. I think it is better to perform this type of work in one of your business or service methods. You could then let your user know if anything was updated. Richard Sent from my iPhone On Mar 31, 2009, at 6:25

Re: How to Compare database record before UPDATE using iBatis?

2009-03-31 Thread Christopher Lamey
On 3/31/09 7:25 AM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: Hm, I usually override equals. Any advantages with hashCode? Just an FYI, if you override equals(), you should almost always override hashcode as well. From the Object.equals Javadoc API: Note that it is generally necessary