> hi,
> ok. but if we declare timestamp field in the database as varchar2 it will
> become much more easier. In java we can generate current timestamp &
> convert that into string then we can assign it to cmp field of type
> String. then we can avoid declaring trigger or alter session command for
> each table
> plz refer to the code given below.
>
>
> public class UserInfoSl implements Serializable
> {
>       public String userID;
>       public String firstName;
>       public String middleName;
>       public String lastName;
>       public String password;
>       public String comments;
>       public float priceLimit;
>       public long aspCustID;
>       public long contactID;
>       public String userCurrentTimestamp;
>
>
> } // close UserInfo
>
>
> public class UserInfoEntityBean extends UserInfoSl implements EntityBean
> {
>
>
>
>       public UserInfoPK ejbCreate(UserInfoSl user)
>       {
>               this.userID = user.userID;
>               this.firstName = user.firstName;
>               this.middleName=user.middleName;
>               this.lastName=user.lastName;
>               this.password=user.password;
>               this.comments=user.comments;
>               this.priceLimit=user.priceLimit;
>               this.aspCustID=user.aspCustID;
>               this.contactID=user.contactID;
>               this.userCurrentTimestamp = getCurrentTimestamp();
>               return null;
>
>       }
>
>       public String getCurrentTimestamp()
>       {
>
>               Timestamp sysDate = new
> Timestamp(System.currentTimeMillis());
>               return sysDate.toString();
>       }
>
> }
>
>
Thanx

Purushotham
> -----Original Message-----
> From: May Charles N [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, July 26, 2000 7:31 AM
> To:   'Purushotham Das K'
> Subject:      RE: CMP - problem
>
>
> It's inserted into the database in its complete form. If you're using SQL+
> to view tables with timestamp information, you won't SEE all the
> information, but if you use JDBC to retrieve the timestamp, you'll see
> that
> it's all there.
>
> > -----Original Message-----
> > From:       Purushotham Das K [SMTP:[EMAIL PROTECTED]]
> > Sent:       Tuesday, July 25, 2000 10:43 AM
> > Subject:    Re: CMP - problem
> >
> > hi Charles,
> >
> > thanx a lot for the suggestion.
> > Itz working fine now but only problem is itz(cmp) inserting time stamp
> in
> > the 26-JUL-00 format to the oracle db.
> > so i altered the DB session by the following command
> > ALTER SESSION SET NLS_DATE_FORMAT = 'DD-mm-YYYY hh24:mi:ss';
> > then itz inserting in 26-07-2000 00:55:34 format.
> >
> > but i am unable to insert complete timestamp (2000-05-14 19:57:04.155).
> >
> > what will be the alter session command to insert to the db in the above
> > format??
> >
> > Thanx
> >
> > Purushotham Das
> >
> > > -----Original Message-----
> > > From: May Charles N [SMTP:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 25, 2000 7:57 AM
> > > To:   [EMAIL PROTECTED]
> > > Subject:      FW: CMP - problem
> > >
> > > Although you can use the java call
> > > new java.sql.Timestamp(System.currentTimeMillis())
> > > to generate the appropriate timestamp, we've found it better to use
> > Oracle
> > > triggers on each table (before insert or update, for each row,
> > referencing
> > > new...) to set this field. That way you don't have to worry about
> > synching
> > > the clocks of multiple app servers if you intend to use the timestamp
> > for
> > > optimistic locking.
> > >
> > > IBM suggested this approach and gives sample DB2 triggers which you
> can
> > > modify for Oracle on page 182 of their redbook SG24-5754-00.
> > >
> > > Charles May, Software Engineer
> > > AFCO Credit Corp. - Pittsburgh Systems Group
> > > A Mellon Financial Company
> > >
> > > > -----Original Message-----
> > > > From: Purushotham Das K [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Saturday, July 22, 2000 7:32 AM
> > > > Subject:      CMP - problem
> > > >
> > > > hi all,
> > > >
> > > >
> > > > i am having some problem while inserting records to the Oracle
> > database
> > > > using cmp bean. I wanna to insert current timestamp for one of the
> > > columns
> > > > which is declared as date(in oracle).
> > > > How CMP field should be declared & How to generate time stamp to
> > achieve
> > > > above task.
> > > > if i declare cmp field as date how to generate current timestamp. if
> > > wanna
> > > > pass sysdate(oracle......current date) how should i pass this using
> > > cmp..
> > > >
> > > >
> > > > Thanx
> > > > Purushotham
> > >
> > >
> >
> ==========================================================================
> > > =
> > > 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