ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rashmi Dave" <rash...@persistent.co.in>
Subject RE: Selective Update of fields depending on values in object
Date Wed, 15 Feb 2006 14:03:58 GMT
Hi Jeff,


I have a form - Update Profile of the User. Here, I would like to update
only those columns that have changed. 


Also, when my user logs in, I want to update only the Last_Login_date field
of the user table. This is why I need it. 


Hope this clarifies.






From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Wednesday, February 15, 2006 7:25 PM
To: user-java@ibatis.apache.org
Subject: Re: Selective Update of fields depending on values in object


Hi Dave,


1. You don't need to regenerate the maps if all you're changing is NOT NULL
to NULL.  Abator doesn't care about the nullability of a column.  But
regenerating the maps shouldn't be a big issue anyway - Abator was designed
so you could run it repeatedly without losing anything extra you've added. 


2. You are correct that the update statement updates all columns.  You'll
need to write custom update statements if you want to update a subset of the


I think it is unusual to do selective column updates if you are working with
anything close to a rich domain model - I've never had that requirement on
any of my projects.  That's why I didn't add support for it in Abator.  I
suppose it wouldn't be that difficult to add if there is a general feeling
that it's needed.  Does anyone else have any thoughts about this? 


Jeff Butler


On 2/15/06, Rashmi Dave <rashmid@persistent.co.in> wrote: 

Hi All,

We are using Abator generated SQL Map configuration files. I have two

1. It turns out that a column in a table that I thought is NOT NULL, should 
be a NULL column. I need to change the schema. Now do I need to re-generate
the SQL Maps again? (Please say I don't have to!!) Is there any information
regarding NULL/NOT NULL property stored?

2. The update query generated by Abator makes it compulsory for us to update

all columns in the table. What do I need to do to selectively update? Can I
somehow reuse the same update generated and avoid writing a different update
query per column? I hope this question isn't an obvious one. Kindly point me

to what feature I need to read the docs about if it is...

Thanks in advance.



View raw message