ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Volkmann <m...@ociweb.com>
Subject Re: DAO update with partial model objects
Date Sun, 25 Mar 2007 12:59:20 GMT
On Mar 25, 2007, at 7:15 AM, Damien McCarthy wrote:

> Mark,
>
> Not using the standard implementation, as there may be times when a  
> user
> would wish to set a column to null.

As Jeff Butler explained a couple of days ago, there are two Spring  
DAO methods for performing an update.
updateByPrimaryKey updates the columns corresponding to every field  
in the model object.
updateByPrimaryKeySelective updates on the columns corresponding to  
non-null fields in the model object.
You can use the first method when you need to set columns to null.

> -----Original Message-----
> From: Mark Volkmann [mailto:mark@ociweb.com]
> Sent: 23 March 2007 19:31
> To: user-java@ibatis.apache.org
> Subject: DAO update with partial model objects
>
> I'm using Spring DAOs generated by Abator. Is it the case that I can
> pass a partially populated model object to a Spring DAO update method
> and it will only update the corresponding columns that have non-null
> values in my model object, leaving the other columns set to their
> current value?
>


Mime
View raw message