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