0 Replies Latest reply on Aug 30, 2003 10:01 PM by cyb_boy

    jbosscmp-jdbc.xml problem

    cyb_boy Newbie

      i am newer,and my sample's jbosscmp-jdbc.xml like following:


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">

      <jbosscmp-jdbc>

      <preferred-relation-mapping>relation-table</preferred-relation-mapping>


      <enterprise-beans>

      <!--
      To add beans that you have deployment descriptor info for, add
      a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
      that contains the markup for those beans.
      -->


      <ejb-name>Forum</ejb-name>
      <table-name>forum</table-name>

      <cmp-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumName</field-name>
      <column-name>forum_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumCnname</field-name>
      <column-name>forum_cnName</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>admin</field-name>
      <column-name>admin</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>registerDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>topic</field-name>
      <column-name>topic</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>Product</ejb-name>
      <table-name>product</table-name>

      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productName</field-name>
      <column-name>product_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productCnname</field-name>
      <column-name>product_cnName</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>admin</field-name>
      <column-name>admin</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>developers</field-name>
      <column-name>developers</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>RegisterDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>topic</field-name>
      <column-name>Topic</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>News</ejb-name>
      <table-name>news</table-name>

      <cmp-field>
      <field-name>newsId</field-name>
      <column-name>news_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>newsName</field-name>
      <column-name>news_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>userId</field-name>
      <column-name>user_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>registerDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>Message</ejb-name>
      <table-name>message</table-name>

      <cmp-field>
      <field-name>messageId</field-name>
      <column-name>message_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>messageName</field-name>
      <column-name>message_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>userId</field-name>
      <column-name>user_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>registerDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>parentId</field-name>
      <column-name>parent_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>hasperson</field-name>
      <column-name>hasPerson</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->


      </enterprise-beans>


      <ejb-relation>
      <ejb-relation-name>Forum-Message</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ForumRelationshipMessage</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Message-has-Forum</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Product-Message</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ProductRelationshipMessage</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Message-has-Product</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Forum-News</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ForumRelationshipNews</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>News-has-Forum</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Product-News</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ProductRelationshipNews</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>News-has-Product</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Product-Forum</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ProductRelationshipForum</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Forum-has-Product</ejb-relationship-role-name>
      <key-fields/>

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


      </jbosscmp-jdbc>

      throws Exception like:

      org.jboss.deployment.DeploymentException: Both roles of a relation-table mapped
      relationship must have key fields: ejb-relation-name=Forum-Message


      if i delete <key-fields/> from jbosscmp-jdbc.xml and
      result like following:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">

      <jbosscmp-jdbc>

      <preferred-relation-mapping>relation-table</preferred-relation-mapping>


      <enterprise-beans>

      <!--
      To add beans that you have deployment descriptor info for, add
      a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
      that contains the markup for those beans.
      -->


      <ejb-name>Forum</ejb-name>
      <table-name>forum</table-name>

      <cmp-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumName</field-name>
      <column-name>forum_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumCnname</field-name>
      <column-name>forum_cnName</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>admin</field-name>
      <column-name>admin</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>registerDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>topic</field-name>
      <column-name>topic</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>Product</ejb-name>
      <table-name>product</table-name>

      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productName</field-name>
      <column-name>product_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productCnname</field-name>
      <column-name>product_cnName</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>admin</field-name>
      <column-name>admin</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>developers</field-name>
      <column-name>developers</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>RegisterDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>topic</field-name>
      <column-name>Topic</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>News</ejb-name>
      <table-name>news</table-name>

      <cmp-field>
      <field-name>newsId</field-name>
      <column-name>news_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>newsName</field-name>
      <column-name>news_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>userId</field-name>
      <column-name>user_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>registerDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>Message</ejb-name>
      <table-name>message</table-name>

      <cmp-field>
      <field-name>messageId</field-name>
      <column-name>message_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>messageName</field-name>
      <column-name>message_name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>content</field-name>
      <column-name>content</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>userId</field-name>
      <column-name>user_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>registerdate</field-name>
      <column-name>registerDate</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      <column-name>remark</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>parentId</field-name>
      <column-name>parent_ID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>hasperson</field-name>
      <column-name>hasPerson</column-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->


      </enterprise-beans>


      <ejb-relation>
      <ejb-relation-name>Forum-Message</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ForumRelationshipMessage</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Message-has-Forum</ejb-relationship-role-name>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Product-Message</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ProductRelationshipMessage</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Message-has-Product</ejb-relationship-role-name>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Forum-News</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ForumRelationshipNews</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>forumId</field-name>
      <column-name>forum_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>News-has-Forum</ejb-relationship-role-name>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Product-News</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ProductRelationshipNews</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>News-has-Product</ejb-relationship-role-name>

      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>Product-Forum</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ProductRelationshipForum</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>productId</field-name>
      <column-name>product_ID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Forum-has-Product</ejb-relationship-role-name>

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


      </jbosscmp-jdbc>

      deploy my Ejb jar is right.



      i can't understand what is the problems.
      who can tell me why.

      thanks!!