0 Replies Latest reply on Mar 12, 2003 9:01 AM by Phyo Kyaw

    unknown-pk and CMR problem, please help!!!

    Phyo Kyaw Newbie

      Dear all,

      I am testing the unknown-pk with jboss 3.2.x, and when I use unknown-pk for a bean, I cant get the pk field name from others to refs to. I am testing with a simple user and userrole example.

      First,
      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <column-name>generated_id</column-name>
      <field-name>userRoleId</field-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="mysql-get-generated-keys">

      unknown-pk works fine. How do I reference the field name for that pk. Then I added many to many relation.

      <ejb-relation>
      <ejb-relation-name>UserAssociatedWithRoles</ejb-relation-name>
      <relation-table-mapping>
      <table-name>user_userroles_tbl</table-name>
      </relation-table-mapping>

      <ejb-relationship-role>
      <ejb-relationship-role-name>UserAssociatedWithRoles</ejb-relationship>
      <key-fields>
      <key-field>
      <field-name>userRoleId</field-name>
      <column-name>userRoleId</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>RolesAssociatedWithUser</ejb-relationship>
      <key-fields>
      <key-field>
      <field-name>emailId</field-name>
      <column-name>userEmailId</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      </ejb-relation>

      First I didnt have <field-name> in unknown-pk tag. But when I want to do relationship, I added that. Still not found the userRoleId that I declared in unknown-pk tag under jbosscmp-jdbc.xml.

      13:48:54,437 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: CMP field not found : fieldName=userRoleId
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.(JDBCEntityMetaData.java:535)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:303)



      Please help!!!!

      Thanks
      Phyo