Hi Mark,

I think the problem with your approach is that Shiv's entity bean will need
to know the value of the id (primary key) obtained from the sequence.

kind regards,

William Louth

> -----Original Message-----
> From: Mark Zawadzki [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, April 26, 2000 11:50 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Entity beans and sequence
>
> Since you are using Oracle, you can use a pre-insert trigger (see the
> Oracle
> docs), then
> it will not matter what the id is going in.
>
> -----Original Message-----
> From: Shiv Kumar [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 26, 2000 2:49 AM
> To: [EMAIL PROTECTED]
> Subject: Entity beans and sequence
>
>
> Hi all
>
> I have an entity bean which maps to a table with three columns :-
>
>      id integer PK
>      name varchar not null
>      description varchar
>
> I have also created a sequence (myseq) in Oracle which will give the next
> number
> in the sequence (myseq.nextval). Whenever the ejbCreate() method is
> called,
> I
> want the following query to be generated:
>
>      insert into t1 values (myseq.nextval, name, description)
>
> where 'name' and 'description' will be passed as parameters to ejbCreate()
> method. I specifically dont want clients to pass the id (PK) as a
> parameter
> because I can always use the sequence to generate the next number. And I
> want my
> bean to use CMP.
>
> How do I achieve this?
>
> Thanks
> --
> shiv
> [EMAIL PROTECTED]
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ==========================================================================
> =
> 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".


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

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