We have the same behavior here, our DBA sure doesn't like it, along with
the putting in '0' for integer fields instead of null :)

Ryan

-----Original Message-----
From: Shannon Ewing [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 8:47 AM
To: 'OJB Users List'
Subject: RE: OJB Clobbers Default Values with Null

I think that should be a temp fix until something better can be done.
What
really is needed is a flag in the repository that can optionally be
added to
a column definition that indicates not to send this column on an insert
(and
update too?) if there is no value. "CF" problem is similar to the one we
have. Ours deals with OJB putting a value into our primary key fields on
insert when the value is auto-generated by the database (in this case MS
SQL
Server). We could not use the "normal" way OJB deals with this issue
because
our database does not support the concept of general sequence key
generation
like Oracle, SAP DB, PostgreSQL, etc. Our fix was to hack the two
classes
that deal with the generation and population of insert statements to not
include that column. Not good but necessary for us. 

So, the best solution that would not only resolve our issue but also
"CF",
would be to simply be able to flag the column to not be included in
inserts
if there is no value. 

-----Original Message-----
From: Mahler Thomas [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 2:23 AM
To: 'OJB Users List'
Subject: RE: OJB Clobbers Default Values with Null


Hi again,

> 
> Hello,
> 
> Way back in OJB 0.9.7 I brought this issue up and I don't 
> think I got much response.  I took an OJB hiatus for a while 
> and now I'm back and have run up against this problem again.  
> The problem is that when I insert a record, OJB tries to 
> insert null values into fields that I did not explicity set 
> in my object.  So if I have specified default values in my 
> database field, which I do quite a bit, those default default 
> values never get used because the query that OJB generates is 
> telling the database to explicitly set those fields to null 
> instead of omitting those fields and letting the db handle it. 
> 
> I find it really hard to believe that I'm the only one that 
> has issues with this... but I don't see much discussion on 
> it.  Am I missing something obvious or does anybody have any 
> good workarounds (besided implementing default values on the 
> application/bean side) or has it been addressed in 0.9.9?

This is still not addressed in 0.9.9 and later!
You can avoid writing to db columns by not providing a field-descriptor
for
the attribute in question.

You could either change an existing class-descriptor at runtime, to
add/remove field-descriptors, 
or use different repositories for read and write phases.

cheers,
Thomas

> 
> Thanks!
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, and more
> 


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


+---------------------------------------------------------+ 
This message may contain confidential and/or privileged information.  If
you
are not the addressee or authorized to receive this for the addressee,
you
must not use, copy, disclose or take any action based on this message or
any
information herein.  If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message.
Thank you for your cooperation.
+---------------------------------------------------------+

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