1 Reply Latest reply on May 20, 2002 1:46 PM by Dain Sundstrom

    Foreign key constraint not added as requested [b]WARNINGS[/b

    Panagiotis Korros Newbie

      When i deploy my cmp entity bean 'NodeBean' with the following xml descriptor files i get these messages on my debug console:

      I am getting these messages
      10:25:33,978 DEBUG [NodeBean] Foreign key constraint not added as requested: relationshipRolename=node-belongsto-parent
      10:25:33,978 DEBUG [NodeBean] Foreign key constraint not added as requested: relationshipRolename=node-has-children

      I am using JBoss 3.0 RC2
      ejb-jar.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>NodeBean</display-name>
      <ejb-name>NodeBean</ejb-name>
      <local-home>ecentric.ejb.NodeLocalHome</local-home>
      ecentric.ejb.NodeLocal
      <ejb-class>ecentric.ejb.NodeBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Node</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>creationDate</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>modifiedDate</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>

      <query-method>
      <method-name>findChildrenOf</method-name>
      <method-params>
      <method-param>java.lang.Integer</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql>SELECT OBJECT(o) FROM Node o WHERE o.parent.id=?1</ejb-ql>


      </enterprise-beans>

      <ejb-relation>
      <ejb-relation-name>node-node</ejb-relation-name>
      <ejb-relationship-role>
      nodeBean
      <ejb-relationship-role-name>node-has-children</ejb-relationship-role-name>
      One
      <relationship-role-source>
      nodeBean
      <ejb-name>NodeBean</ejb-name>
      </relationship-role-source>
      <cmr-field>
      nodeBean
      <cmr-field-name>children</cmr-field-name>
      <cmr-field-type>java.util.Set</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      nodeBean
      <ejb-relationship-role-name>node-belongsto-parent</ejb-relationship-role-name>
      Many
      <cascade-delete />
      <relationship-role-source>
      nodeBean
      <ejb-name>NodeBean</ejb-name>
      </relationship-role-source>
      <cmr-field>
      nodeBean
      <cmr-field-name>parent</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>NodeBean</ejb-name>
      <method-name>*</method-name>

      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      jbosscmp-jdbc.xml contents:
      <?xml version="1.0" encoding="UTF-8"?>
      <jbosscmp-jdbc>

      java:/SQLServerPool
      <type-mapping>MS SQLSERVER2000</type-mapping>
      true
      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <read-only>true</read-only>
      <time-out>300000</time-out>
      <select-for-update>false</select-for-update>
      <pk-constraint>true</pk-constraint>
      <relation-mapping-style>foreign-key</relation-mapping-style>
      <read-ahead>
      on-load
      255
      <cache-size>1000</cache-size>
      </read-ahead>

      <enterprise-beans>

      <ejb-name>NodeBean</ejb-name>
      <table-name>ttree</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>treeid</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>creationDate</field-name>
      <column-name>datecreated</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>modifiedDate</field-name>
      <column-name>datemodified</column-name>
      </cmp-field>

      </enterprise-beans>

      <ejb-relation>
      <ejb-relation-name>node-node</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>node-has-children</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>id</field-name>
      <column-name>parentid</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>node-belongsto-parent</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>

      </jbosscmp-jdbc>