It appears to be working fine.
I'm definately not an expert, but what I think is happening is that the key
is built between the ejbCreate() and super.postCreate(). So, as long as I
assign my field (sequenceNumber) that is the primary key to the value I get
back from the query (inside ejbCreate) that the correct value should be in
the key object.
I'm not sure that this is actually the case, but that's what appears to be
happening when I walk through it in the debugger.
Dan
> -----Original Message-----
> From: Floyd Marinescu [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, June 12, 2000 3:02 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Creating Entity Beans with db generated sequence numbers
>
> So what happens when the following occurs:
>
> >Inside the ejbCreate() method, we added code to
> >* get a Connection from DriverManager
> >* from the Connection, get a PreparedStatement with the SQL to grab
> >the next sequence number from the db
> > ("SELECT customer_seq.nextval FROM dual")
>
> ====== ROW INSERTED FROM ANOTHER TRANSACTION HERE ==========
>
> >* execute the prepared statement query
> >* grab the sequence number out of the result set.
> >* close the Connection
>
> If this happens then your create method will return the wrong
> primary key
> to the client won't it?
>
> Floyd
>
> ---------------------------------
> Senior Architect
> The Middleware Company
> http://www.middleware-company.com
> [EMAIL PROTECTED]
> 416-889-6115
>
>
===========================================================================
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".