1 Reply Latest reply on Sep 1, 2004 5:17 AM by harshi2003

    help me! Jboss doesn't create PK JAVA file for primary key o

    kuhan77

      hai.
      my server is -jboss3.2.1
      ide-eclipse 2.1;

      i have created a CMP bean with primary key of 'int' type which is related to autoincrement in mysql.
      i have created getField()in bean.
      i have created public int ejbCreate(*,*,*){ return int}, because ejbCreate methos must return Primary Key type.
      after that i generated ejb classes in jboss3.2.1.

      my problem:
      -----------
      1)in ejbsrc folder of workspace all files related CMP bean is created except PrimaryKey class.
      2)in Home interface file itself, eclipse creates findByPrimaryKey(). but There is no PrimaryKey Java file for this CMP with primary key of AutoIncrement.

      Please help me to fix the problem

        • 1. Re: help me! Jboss doesn't create PK JAVA file for primary k
          harshi2003

          i am using jboss-3.2.3 with my eclipse ide.

          you have to use Integer as the primart key type and also include following for auto increament field


          * @ejb.pk class = "java.lang.Integer"

          @jboss.unknown-pk class = "java.lang.Integer" column-name = "sid" auto-increment = "true" sql-type = "INT(11)" jdbc-type = "INTEGER"
          * @jboss.entity-command name="mysql-get-generated-keys" class = "org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand"

          then before u delcare getter and setter methods include following code for auto increament

          @jboss.persistence auto-increment = "true"

          hope this is help ful to you