hi,

At 15:27 07.07.2003 +0300, Alexey Loubyansky wrote:
Hello Rafal,

make sure there is mysql-get-generated-keys entity-command in
standardjbosscmp-jdbc.xml.

this is defined as:

<entity-command name="mysql-get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand"/>


What version are you using, BTW?


JBoss 3.2.2beta and MySQL 4.0.13.

currently I changed the definition to:

        <entity>
            <ejb-name>Users_2_GroupsBean</ejb-name>
            <read-ahead>
                <strategy>on-load</strategy>
                <page-size>4</page-size>
                <eager-load-group>*</eager-load-group>
            </read-ahead>
            <list-cache-max>1000</list-cache-max>
            <table-name>users_2_groups</table-name>
            <cmp-field>
                <field-name>users_2_groups_id</field-name>
                <column-name>users_2_groups_id</column-name>
                <auto-increment/>
            </cmp-field>
            <cmp-field>
                <field-name>users_id</field-name>
                <column-name>users_id</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>groups_id</field-name>
                <column-name>groups_id</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>valid_from</field-name>
                <column-name>valid_from</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>expired</field-name>
                <column-name>expired</column-name>
            </cmp-field>
            <!-- <entity-command name="pk-sql">
                <attribute name="pk-sql">SELECT nextval('users_2_groups_seq')</attribute>
            </entity-command> -->
            <entity-command name="pk-sql">
                <attribute name="pk-sql">SELECT LAST_INSERT_ID()</attribute>
            </entity-command>
        </entity>


But no I get this message:

2003-07-07 15:26:07,165 FATAL [net.magix.xmlapi.request.category.CreateCategoryRequest] run() failed
javax.ejb.DuplicateKeyException: Entity with primary key 3 already exists
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCInsertPKCreateCommand.beforeInsert(JDBCInsertPKCreateCommand.java:82)

the business logic dosn't change while replacing database.


Rafal

Reply via email to