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

    autoincrement jboss 3.2.1 mysql 4.1

    gast73 Newbie

      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:



      <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?