Re: Please help with mapping Ibatis

2009-03-31 Thread Ingmar Lötzsch
I have a class public class Part{ private Integer id; private String name; private Bar bar; getters/setters } I have a mapping for part and for there part I am adding aliases for column names after join. I am sure it is not correct way to do it. Please advice how to do

Check database before INSERT in iBatis

2009-03-31 Thread Jasmin Mehta
Hi, I have customer registration web application. Where it takes 3 pages to complete the process before submit. Once customer is registered, i.e. the records are inserted into 3 different tables then user can edit the registration. Right now, I have a code that retrieves the record from each

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
Richard, Thanks for your reply. I would like to clarify my understanding about what you have mentioned. Here is one of my VO generated thru JDeveloper IDE, it has both equals() and hashCode() methods overriden. So now to you point, I can use equals() method too? right? But I still have to

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

Re: Please help with mapping Ibatis

2009-03-31 Thread AlexElba
So only way is to do with aliases? No way I can reuse the already mapped dto other then remap it? Ingmar Lötzsch wrote: I have a class public class Part{ private Integer id; private String name; private Bar bar; getters/setters } I have a mapping for part and for there

Re: Please help with mapping Ibatis

2009-03-31 Thread Ingmar Lötzsch
So only way is to do with aliases? No way I can reuse the already mapped dto other then remap it? You can use the select attribute instead of resultMap. You can combine this with lazy loading. Ingmar