2 Replies Latest reply on Jul 15, 2003 8:29 AM by Roger Ackroyd

    autoincrement jboss 3.2.1 mysql 4.1

    gast73 Newbie

      Hello
      I configured Jboss 3.2.1 to use mysql 4.1 as DefaultDS
      Everything seems to work.
      Then I tried to use autoincrement feature following mony posts on yhis forum.

      So I changed standardjbosscmp-jdbc.xml:


      java:/DefaultDS
      <datasource-mapping>mySQL</datasource-mapping>

      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>
      <time-out>300</time-out>
      <pk-constraint>true</pk-constraint>
      <fk-constraint>false</fk-constraint>
      <row-locking>false</row-locking>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
      <read-ahead>
      on-load
      <page-size>1000</page-size>
      <eager-load-group>*</eager-load-group>
      </read-ahead>
      <list-cache-max>1000</list-cache-max>

      <entity-command name="default"/>



      .....

      removing unknown-pk entry

      Then I wrote an entity bean using xdoclet:

      /**
      * @jboss.unknown-pk
      * class="java.lang.Integer"
      * column-name="id"
      * jdbc-type="INTEGER"
      * sql-type="INTEGER"
      * auto-increment="true"
      * @jboss.entity-command name="mysql-get-generated-keys"
      */

      /**
      *
      * @ejb.pk-field
      * @ejb.persistent-field
      * @ejb.interface-method
      *
      * @ejb.persistence column-name="id"
      *
      * @jboss.auto-increment
      */
      public abstract Integer getId();

      /**
      */
      public abstract void setId(Integer id);



      It builds and deploys fine.
      But when I call a create method from the bean home
      I retrieve the bean interface and Calling getId() method I get a ClassCastException.
      I tried a lot of different configurations. I tried to remove the unknown-pk entry. Put it back in standardjbosscmp-jdbc.xml.
      Set in standardjbosscmp-jdbc.xml the entity-command to use it as default.
      I use JConnector 3.0.8 for mysql.
      Any advice?