4 Replies Latest reply on Mar 13, 2004 7:46 AM by Alexey Loubyansky

    Logical mapping of PK Class

    shaikaman Newbie

      Hi all,

      I've a sample CMP in Jboss4.0. In my ejb-jar.xml i've given as,


      <![CDATA[UserRegBean EJB]]>
      <display-name>UserRegBean</display-name>

      <ejb-name>UserRegBean</ejb-name>

      com.reg.cmp.ejb.UserRegBeanHome
      com.reg.cmp.ejb.UserRegBean

      <ejb-class>com.reg.cmp.ejb.UserRegBeanCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.reg.cmp.ejb.UserRegBeanPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>UserRegBean</abstract-schema-name>


      <cmp-field>
      <field-name>userId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>userName</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>password</field-name>
      </cmp-field>


      I've mapped PK class in this. But, when I deploy I get the following exception ..

      12:04:09,618 WARN [JDBCMetaDataMigrationUtil] Unable to find logical mapping for primary key class: com.reg.cmp.ejb.UserRegBeanPK
      12:04:11,633 ERROR [EntityContainer] Starting failed: java.lang.NullPointerException
      12:04:11,633 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=UserRegBean,service=EJB
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCTypeFactory.createTypeSimple(JDBCTypeFactory.java:115)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCTypeFactory.getJDBCType(JDBCTypeFactory.java:77)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.(JDBCAbstractCMPFieldBridge.java:71)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.(JDBCCMP2xFieldBridge.java:47)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.createCMPField(JDBCEntityBridge.java:313)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.loadCMPFields(JDBCEntityBridge.java:183)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.(JDBCEntityBridge.java:122)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:513)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:428)
      at org.jboss.ejb.entity.CMPInterceptor.start(CMPInterceptor.java:57)
      at org.jboss.ejb.entity.SimplePersistenceManager.start(SimplePersistenceManager.java:79)
      :
      :
      :
      :

      I dont know where else I need to map this key field. But I'm sure I dont need to.
      Btw, Do we need to have jbosscmp-jdbc.xml ...or jaws.xml is enough..?

      TIA,

      Regards,
      aman.