Do you really want this? Your object would not reflect the value in the
database! Set the 'N' as default in your object (e.g. at creation time) and
everything is fine,isn't it?

-----Original Message-----
From: Robert J Celestino [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 30. Oktober 2003 23:16
To: OJB Users List; [EMAIL PROTECTED]
Subject: Default values


Hello All, 

I am wondering how to get ojb to respect default fields. (if it matters, I
am using MySql and Weblogic). 

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'

My domain class has a field of the same name. The intent is to have the
database supply the default when it is not explicitly set. For example, an
insert like this would work: 

        insert into mytable ( Id ) values ( 123 ) ;

And the resulting record would have a value of 'N' (the default) set for the
SecurityUseType. 

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 ) ; 

Indeed the value on the java side is null. 

Is there some way to tell ojb to not explicitly set it to null? 

Thanks!
bobc

----------------------------------------------------------------
Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


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


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

Reply via email to