ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: question on default values in Ibator Insert
Date Thu, 24 Jul 2008 21:38:22 GMT
I've added an insertSelective method to ibator in SVN.  It works as I expect
in my unit tests: the column default value is used if the corresponding
property in the object is null.

Give it a try and let me know if it meets your needs.

Jeff Butler

On Wed, Jul 23, 2008 at 11:47 AM, Jeff Butler <jeffgbutler@gmail.com> wrote:

>  I'm glad you like ibator.
> It sounds like the only way to force the default value is to not send the
> column on the insert statement.  This would require a new ibator method -
> like insertSelective (analgous to the current updateByXXXSelective
> methods).  Its probably not too difficult to do - I'll take a look.
> Jeff Butler
>   On Wed, Jul 23, 2008 at 10:03 AM, Robert Glover <
> robertgloverjr@yahoo.com> wrote:
>>      Disclaimer:  I think Ibator is the greatest thing since bread.
>> Ibator rocks!
>>     A programmer who has taken over an Ibatis Ibator program I wrote,
>> asked me about the behavior of an Ibator generated INSERT statement as
>> regards a column that allows nulls but has a default value.  This developer
>> would like to know how to make Ibator use the default value of the column
>> when the INSERT occurs.
>>    In looking at the INSERT statement which iBator generates, It looks to
>> me that it sets the column to null when the property in the domain object
>> does not have a value for that column.  Oracle subsequently does not insert
>> the default value because, apparantly, setting the column to null seems to
>> be considered an override of the default value.
>>    Is there any value I can set the property in the domain object to, so
>> that when I pass it to the Ibator Insert it will use the default value?
>> Thank you in advance,
>> a great iBator Fan,
>> Robert

View raw message