Nothing should be changed in ejb-jar.xml. This is set
up in jbosscmp-jdbc.xml. The following field will be
auto-incremented:
<cmp-field>
<field-name>myId</field-name>
</auto-increment>
</cmp-field>
Also
the entity which has auto-incremented primary key should specify an
entity-command that implements specific auto-incrementation. For MySql it
is:
<entity>
<ejb-name>MyEntity</ejb-name>
...
<entity-command
name="mysql-get-generated-keys"/>
</entity>
Refer
to jbosscmp-jdbc_3_2.dtd and standardjbosscmp-jdbc.xml for configuration and
available entity-commands.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of aaaa aaaa
Sent: Sunday, January 04, 2004 8:38 PM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] key auto-increment in Jboss3.2.2 and MySqlHi,Some time ago, there was some discusion about auto-increment for the key (mySQL database is supported). But I looked email archive, I couldn't find answer to my question.Say I have an ejb bean with a key for auto-increment. What changes I should make to ejb-jar.xml (or other deployment descriptors, or something else) so that jboss will know the key is auto-increment-template?(In the standardjbosscmp-jdbc.xml file, there was a line for mySQL database.:<auto-increment-template>?1 auto_increment</auto-increment-template>)If possible, any examples?Any help is appreciated.Mark
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003