What for NOT NULL?
Perhaps something ancient, from times when a DBMS was indeed managing data?
;-)
What will the future be for caching, locking, transaction control,
referential integrity...?


-----Original Message-----
From: Robert J Celestino [mailto:[EMAIL PROTECTED]
Sent: Freitag, 31. Oktober 2003 16:03
To: OJB Users List
Subject: RE: Default values


I see what you mean but, yea, I really do want this :-) 

This is legacy stuff, so I am not totally defending it. But the idea was to
define the default in the database. If the default were to change, it would
be a change in one place (the database). 

You are right that the object model and the db are slightly out of whack
until the object is materialized. But with security things, the object is
not usable until it was looked up and read from the db. So the fact that the
security use type is null in a newly created object is OK. 

OK in the sense that the system will "work". 

But the more I think of it, the default values SHOULD be in the object model
and NOT in the DB. So I am changing my position: I really *don't* want this
:-) 

Btw given this, what use is the DEFAULT keyword in the database?  

Thanks all

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

SAS - The Power to Know


  > -----Original Message-----
  > From: [EMAIL PROTECTED] 
  > [mailto:[EMAIL PROTECTED] 
  > Sent: Friday, October 31, 2003 2:19 AM
  > To: [EMAIL PROTECTED]
  > Subject: RE: Default values
  > 
  > 
  > 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]
  > 
  > 

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