0 Replies Latest reply on Nov 27, 2003 9:45 AM by relisanhard521

    getGeneratedKeys() returns an empty resultset

    relisanhard521 Newbie

      Hi,
      I am installing a auto increment in my CMP. I do not get any deploy time errors but when I home.create(params) i get an exception saying getGeneratedKeys() returned an empty result set. However when I check mysql I see a record inserted with id as 0.

      when i run the home.create() again, I get a duplcate key error.

      I have my jbosscmp-jdbc andejb-jar.xml files below..
      Any ideas greatly appreciated... thanks!




      jbosscmp-jdbc.xml as


      <!DOCTYPE jbosscmp-jdbc PUBLIC
      "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">

      <jbosscmp-jdbc>



      java:/MySqlDS
      <datasource-mapping>mySQL</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>false</remove-table>



      <enterprise-beans>

      <ejb-name>Prof</ejb-name>
      <table-name>prof</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>id</column-name>
      <auto-increment/>
      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>
      <column-name>name</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>subject</field-name>
      <column-name>subject</column-name>
      </cmp-field>

      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <column-name>id</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER(11)</sql-type>
      </unknown-pk>

      <entity-command name="mysql-get-generated-keys"/>




      and ejb-jar.xml as

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>Prof</display-name>
      <ejb-name>Prof</ejb-name>
      <local-home>ejbproj.project.ProfHome</local-home>
      ejbproj.project.Prof
      <ejb-class>ejbproj.project.ProfBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Prof</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>subject</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>