You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by David Carew <dc...@gmail.com> on 2006/02/22 20:19:33 UTC
Question about CMP Entity Bean key generation
I'm trying to do this in DB2 . I found an example of a deployment plan in
Aaron Mulder's book but I don't recognize this particular SQL dialect.
<key-generator> <sql-generator> <sql>select nextval('person_seq')</sql>
<return-type>java.lang.Integer</return-type> </sql-generator>
Will the container use the contents of <sql> in the Values clause of an
INSERT statement like this
e.g. insert into foo values (contents of <sql>,....)
or will it execute the contents of <sql> as a separate statement and expect
it to return a single value of the appropriate type ? In DB2 this would be
select (nextval for mysequence) from sysibm.sysdummy1
>From the example in the book I would guess the latter approach is what is
expected but I just wanted to verify this.
Re: Question about CMP Entity Bean key generation
Posted by Aaron Mulder <am...@alumni.princeton.edu>.
It executes the SQL separately to get the ID, and then does an insert
with that ID. The example used PostgreSQL syntax.
Thanks,
Aaron
On 2/22/06, David Carew <dc...@gmail.com> wrote:
> I'm trying to do this in DB2 . I found an example of a deployment plan in
> Aaron Mulder's book but I don't recognize this particular SQL dialect.
>
> <key-generator> <sql-generator> <sql>select nextval('person_seq')</sql>
> <return-type>java.lang.Integer</return-type> </sql-generator>
>
>
> Will the container use the contents of <sql> in the Values clause of an
> INSERT statement like this
>
> e.g. insert into foo values (contents of <sql>,....)
>
> or will it execute the contents of <sql> as a separate statement and expect
> it to return a single value of the appropriate type ? In DB2 this would be
>
> select (nextval for mysequence) from sysibm.sysdummy1
>
> From the example in the book I would guess the latter approach is what is
> expected but I just wanted to verify this.
>