Hello,

> -----Original Message-----
> From: Robert J Celestino [mailto:[EMAIL PROTECTED]

> I have a table that has a field defined as non-nullable and 
> with a default like so: 
>       SecurityUseType varchar(1) NOT NULL DEFAULT 'N'

[..]

> However, using ojb (both PersistenceBroker and ODMG 
> interfaces) when the ld is not set, ojb will attempt to set 
> it to null. So I assume it is doing something like this: 
> 
>       insert into mytable ( Id, SecurityUseType ) values( 
> 123, null ) ; 

I think so, too. You can verify this by switching on p6spy.

> Indeed the value on the java side is null. 
> 
> Is there some way to tell ojb to not explicitly set it to null? 

I do not think so.

Why do you want that?

Is there a reason why that field is in that class but not
set correctly?

I mean, why don't you just assign the 'N' to the field
in each constructor and forget about the database default?

Another idea is maybe to introduce an inheritance in your
model and make that field inherited, but map the base class
and the derived class to the same table.  In that case, if you
save an instance of the base class (that does not have that
particular field at all), then OJB will not try to set it
in any way, so the database default applies.

HTH,
        Olli





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to