Another thing you can try is declare a second object to the same table...
So that in you code you need to check whether you want to use the default values then 
you use this second object.
If you need to fill all columns you use the original object.

I have a table for persons which includes a blob (a photo)..
I created several objects mapped to the same table..
one object has all the columns (except photo).
another object has pk and photo.
some objects only fetch (and save) a subset of data.

It works because the layout of my application is such that this is possible.

Axel Guerrero

-----Original Message-----
From: Manukyan, Sergey [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 04, 2004 12:31 PM
To: 'OJB Users List'
Subject: RE: insert object, and don't specify a value for one of the
fields


Hi Armin,

If I declare this field as readonly, then it will be always readonly, but I
need to update on UPDATE operations, and omit on INSERT operations.
I guess the possible solution I am seeking for could be to declare something
like this:
 
<field-descriptor 
        name="dateChanged" 
        column="DATECH" 
        jdbc-type="DATE"        
        use-database-default-if-null-on-insert-operations = "true" />

Or can I somehow dynamically exclude this field from participating in
operation, whatever this operation might be? Similar to ObjectModification
class mechanism, but that will exclude this field from operation only for
this Broker?

I know I can dynamically change the class descriptor and set this field to
anonymous and then revert it back to normal, but I am afraid this will
impact other Brokers operations with this class,

-Sergey



-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 04, 2004 11:30 AM
To: OJB Users List
Subject: Re: insert object, and don't specify a value for one of the fields

Hi Sergey,

Manukyan, Sergey wrote:

> Folks,
> 
> The thing is I need to insert a record where for one of the fields I want
to
> omit value, not specify at all, not even null, nothing. So that in INSERT
> operation it will not be present at all and will be populated by the
default
> value from database. Is there a way how I can do that?
> 

you can try to declare field as access="readonly".

regards,
Armin

> Thank you,
> -Sergey
> 
> **********************
> ** LEGAL DISCLAIMER **
> **********************
> 
> This E-mail message and any attachments may contain 
> legally privileged, confidential or proprietary 
> information. If you are not the intended recipient(s),
> or the employee or agent responsible for delivery of 
> this message to the intended recipient(s), you are 
> hereby notified that any dissemination, distribution 
> or copying of this E-mail message is strictly 
> prohibited. If you have received this message in 
> error, please immediately notify the sender and 
> delete this E-mail message from your computer.
> 
> ---------------------------------------------------------------------
> 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