Hi Vaidya,

I am not sure how WLS behaves but if it is possible to avoid the update
(setdate_last_updated method with null parameter) your problem can be
resolved.

If the following behaviour is correct / configurable,

1. Create the record in a single transaction. (no stores should happen in
this transaction)
2. While calling business method on the same entity, make sure that the bean
state is again loaded. (something similar to a write bean should work?)
3. Now the cmp-field date_last_updated is loaded with the default value that
db has inserted while creating the record. So subsequent stores would not
set the value to null.

Is this observation valid?

<vendor>
Pramati Server allows the user to specify the default value for selected
types for the database column. These values are available in the
ejbPostCreate<METHOD> and subsequently.
</vendor>

Regards,
Hemant
www.pramati.com

----- Original Message -----
From: "Vaidya Krishnamurthy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 22, 2002 11:44 AM
Subject: CMP 2.0 and database defaults


Hi ,

     I am trying to create a CMP 2.0 ( WLS 6.1 sp2 )  bean which has a
column  managed by the database. How can I handle create/ update...

     In my bean the create method looks like this...

          create ( ValueObject x )
          {
               setattr1 ( x.getattr1() )
               .
               .
               setattrn( x.getattrn() )

               // setdate_last_updated is not called specifically      bcos
I don't know the timestamp yet
          }

          The date_last_updated column is for further use in case of
updates...

          But I suspect that the container calls the setdate_last_updated
method with null parameter when the row is created... ( ofcourse after the
database sets it )

          In other words, How can I flag the container/persistence manager
to ignore setXXX during create time.

Thanks much for ur thoughts,
Vaidya

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to