Thanks.
But I would like to have it database independent. Vinay's suggestion seems
to point in that direction, but I didn't figure out yet, how it works.

Ralph

----- Original Message -----
From: Jim Brownfield <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 4:39 PM
Subject: RE: [JBoss-user] EJB question


> I believe this is dependent upon the underlying database implementation.
> For instance, in Informix, if you have an autoincrement (called SERIAL
type
> in Informix), you could make the function call
"DBINFO( 'sqlca.sqlerrd1' )"
> to get the last value of a serial type that was created by the database
> thread.  There's probably a way to do this in the database you're using
(I'm
> not familiar with Cloudscape).
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Ralph
Jensen
> > Sent: Friday, May 04, 2001 12:09 AM
> > To: [EMAIL PROTECTED]
> > Subject: [JBoss-user] EJB question
> >
> >
> > I asked this question elsewhere, but didn't get an answer. So:
> >
> > An entity bean's ejbCreate(...) method MUST return the primary
> > key. That is
> > not a problem, if I specify the primary key myself and pass it to the
> > create(...) method.
> >
> > But I want to let the database assign the primary key by creating a
table
> > with an AUTOINCREMENT default for the primary key column, like in this
> > example using Cloudscape (part of SUN's J2EE v1.3):
> >
> > create table myTable(
> >    id INT DEFAULT AUTOINCREMENT CONSTRAINT pk_id PRIMARY KEY,
> >    someString VARCHAR(6),
> >    etc.
> > );
> >
> > Then I can use INSERT like this:
> >    INSERT INTO mytable ( someString ) VALUES ( 'Hello' );
> >
> > The database then assigns a unique value to the id column of that new
> > record.
> >
> > If I do this in the ejbCreate(...) method of my bean my problem is: How
do
> > I know that value in order to return it? Is that possible?
> >
> > Thanks
> >
> > Ralph Jensen
> >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to