0 Replies Latest reply on Jan 16, 2004 9:11 AM by mfr

    Both roles of a relation-table mapped relationship must have

    mfr Newbie

      hi all,
      with jboss 3.2.2RC4 , trying to configure one to many relationship with primary key generated using unknown-pk (need 3_2 dtd)
      the relationship is working if deployement descriptor is in dtd 3_0 but with dtd (without primary key generation ) but with dtd 3_2 i get the following error:

      org.jboss.deployment.DeploymentException: Both roles of a relation-table mapped
      relationship must have key fields: ejb-relation-name=tagmap-ressdests
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(J
      DBCRelationMetaData.java:359)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:469)


      <?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 >

      <![CDATA[No Description.]]>
      <display-name>Generated by XDoclet</display-name>

      <enterprise-beans>

      <!-- Session Beans -->

      <![CDATA[EJB DG Service provisioning]]>
      <display-name>DG Service provisioning</display-name>

      <ejb-name>Provisioning</ejb-name>

      com.slb.prti.dg.interfaces.ProvisioningHome
      com.slb.prti.dg.interfaces.Provisioning
      <ejb-class>com.slb.prti.dg.ejb.ProvisioningSBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>




      <![CDATA[EJB DG workflow]]>
      <display-name>DG Identification and normalization EJB</display-name>

      <ejb-name>IdentAndNorm</ejb-name>

      com.slb.prti.dg.interfaces.IdentAndNormHome
      com.slb.prti.dg.interfaces.IdentAndNorm
      <ejb-class>com.slb.prti.dg.ejb.IdentAndNormSBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>




      <![CDATA[EJB DG workflow]]>
      <display-name>CSV File loader</display-name>

      <ejb-name>CSVLoader</ejb-name>

      com.slb.prti.dg.interfaces.CSVLoaderHome
      com.slb.prti.dg.interfaces.CSVLoader
      <ejb-class>com.slb.prti.dg.ejb.CSVLoaderSBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



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

      <!-- Entity Beans -->

      <![CDATA[RessDestEBeanThis entity Bean represents a record for the RESSDEST relational database table.]]>

      <ejb-name>RessDest</ejb-name>

      com.slb.prti.dg.interfaces.RessDestHome
      com.slb.prti.dg.interfaces.RessDest
      <local-home>com.slb.prti.dg.interfaces.RessDestLocalHome</local-home>
      com.slb.prti.dg.interfaces.RessDestLocal

      <ejb-class>com.slb.prti.dg.ejb.RessDestCMP</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>RessDest</abstract-schema-name>
      <cmp-field >
      <![CDATA[]]>
      <field-name>ressDestId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>outputId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>type</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>externalTagIdFk</field-name>
      </cmp-field>
      <primkey-field>ressDestId</primkey-field>

      <!-- Write a file named ejb-finders-RessDestEBean.xml if you want to define extra finders. -->



      <![CDATA[TagMapperEBeanThis entity Bean represents a record for the TAGMAP relational database table.]]>

      <ejb-name>TagMapper</ejb-name>

      com.slb.prti.dg.interfaces.TagMapperHome
      com.slb.prti.dg.interfaces.TagMapper
      <local-home>com.slb.prti.dg.interfaces.TagMapperLocalHome</local-home>
      com.slb.prti.dg.interfaces.TagMapperLocal

      <ejb-class>com.slb.prti.dg.ejb.TagMapperCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>TagMapper</abstract-schema-name>
      <cmp-field >
      <![CDATA[]]>
      <field-name>externalTagId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>internalTagId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>type</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>reductThresholdValue</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>watchIntervalTime</field-name>
      </cmp-field>
      <primkey-field>externalTagId</primkey-field>


      <query-method>
      <method-name>findByExternalTagId</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Remote</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM TagMapper o WHERE o.externalTagId = ?1]]></ejb-ql>


      <query-method>
      <method-name>findByExternalTagId</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM TagMapper o WHERE o.externalTagId = ?1]]></ejb-ql>

      <!-- Write a file named ejb-finders-TagMapperEBean.xml if you want to define extra finders. -->



      <![CDATA[RejectedTagEBean This entity Bean represents a record for the REJECTEDTAG relational database table.]]>

      <ejb-name>RejectedTag</ejb-name>

      com.slb.prti.dg.interfaces.RejectedTagHome
      com.slb.prti.dg.interfaces.RejectedTag
      <local-home>com.slb.prti.dg.interfaces.RejectedTagLocalHome</local-home>
      com.slb.prti.dg.interfaces.RejectedTagLocal

      <ejb-class>com.slb.prti.dg.ejb.RejectedTagCMP</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>RejectedTag</abstract-schema-name>
      <cmp-field >
      <![CDATA[]]>
      <field-name>rejectedTagId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>rejectReason</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>timeStamp</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>wellUid</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>wellBoreUid</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>channelName</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>internalTag</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>channelValue</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[]]>
      <field-name>qualData</field-name>
      </cmp-field>
      <primkey-field>rejectedTagId</primkey-field>

      <!-- Write a file named ejb-finders-RejectedTagEBean.xml if you want to define extra finders. -->


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

      <!-- Message Driven Beans -->
      <!-- Message Driven Beans -->
      <message-driven >
      <![CDATA[EJB FDExec application client message]]>
      <display-name>Message Driven FDExec client Bean</display-name>

      <ejb-name>FDExecMDBean1</ejb-name>

      <ejb-class>com.slb.prti.dg.ejb.FDExecMDBean</ejb-class>

      <transaction-type>Container</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>NonDurable</subscription-durability>
      </message-driven-destination>

      </message-driven>
      <message-driven >
      <![CDATA[EJB FDExec application client message]]>
      <display-name>Message Driven FDExec client Bean</display-name>

      <ejb-name>FDExecMDBean2</ejb-name>

      <ejb-class>com.slb.prti.dg.ejb.FDExecMDBean</ejb-class>

      <transaction-type>Container</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>NonDurable</subscription-durability>
      </message-driven-destination>

      </message-driven>
      <message-driven >
      <![CDATA[EJB FDExec application client message]]>
      <display-name>Message Driven FDExec client Bean</display-name>

      <ejb-name>FDExecMDBean3</ejb-name>

      <ejb-class>com.slb.prti.dg.ejb.FDExecMDBean</ejb-class>

      <transaction-type>Container</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>NonDurable</subscription-durability>
      </message-driven-destination>

      </message-driven>

      </enterprise-beans>

      <!-- Relationships -->

      <ejb-relation >
      <ejb-relation-name>tagmap-ressdests</ejb-relation-name>

      <ejb-relationship-role >
      <ejb-relationship-role-name>tagmap-has-ressdests</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>TagMapper</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>ressourceDests</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role >
      <ejb-relationship-role-name>ressdest-has-tagmap</ejb-relationship-role-name>
      Many
      <relationship-role-source >
      <ejb-name>RessDest</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>

      </ejb-relation>


      <!-- Assembly Descriptor -->
      <assembly-descriptor >
      <!--
      To add additional assembly descriptor info here, add a file to your
      XDoclet merge directory called assembly-descriptor.xml that contains
      the <assembly-descriptor></assembly-descriptor> markup.
      -->

      <!-- finder permissions -->

      <!-- finder permissions -->

      <!-- finder permissions -->

      <!-- finder permissions -->

      <!-- finder permissions -->

      <!-- finder permissions -->

      <!-- transactions -->
      <container-transaction >

      <ejb-name>RessDest</ejb-name>
      <method-intf>LocalHome</method-intf>
      <method-name>create</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      </method-params>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction >

      <ejb-name>RessDest</ejb-name>
      <method-intf>Home</method-intf>
      <method-name>create</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      </method-params>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction >

      <ejb-name>TagMapper</ejb-name>
      <method-intf>LocalHome</method-intf>
      <method-name>create</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      <method-param>int</method-param>
      <method-param>int</method-param>
      </method-params>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction >

      <ejb-name>TagMapper</ejb-name>
      <method-intf>Home</method-intf>
      <method-name>create</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      <method-param>int</method-param>
      <method-param>int</method-param>
      </method-params>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>

      <!-- finder transactions -->
      </assembly-descriptor>

      </ejb-jar>



      <?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>

      java:OracleDS
      <datasource-mapping>Oracle9i</datasource-mapping>
      <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>RessDest</ejb-name>
      <table-name>ressdest</table-name>

      <cmp-field>
      <field-name>ressDestId</field-name>
      <column-name>ressdest_id</column-name>

      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>outputId</field-name>
      <column-name>output_id</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(64)</sql-type>

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

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(5)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>externalTagIdFk</field-name>
      <column-name>external_tag_id_fk</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(128)</sql-type>

      </cmp-field>

      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <field-name>ressDestId</field-name>
      <column-name>ressdest_id</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="pk-sql">
      SELECT S_RESSDEST.nextval FROM DUAL
      </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>TagMapper</ejb-name>
      <table-name>tagmap</table-name>

      <cmp-field>
      <field-name>externalTagId</field-name>
      <column-name>external_tag_id</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(128)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>internalTagId</field-name>
      <column-name>internal_tag_id</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(128)</sql-type>

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

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(5)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>reductThresholdValue</field-name>
      <column-name>reduct_threshold_value</column-name>

      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>watchIntervalTime</field-name>
      <column-name>watch_interval_time</column-name>

      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>

      </cmp-field>

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



      <ejb-name>RejectedTag</ejb-name>

      <cmp-field>
      <field-name>rejectedTagId</field-name>
      <column-name>rejectedtag_id</column-name>

      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>rejectReason</field-name>
      <column-name>reject_reason</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(32)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>timeStamp</field-name>
      <column-name>timestamp</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(32)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>wellUid</field-name>
      <column-name>welluid</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(64)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>wellBoreUid</field-name>
      <column-name>wellboreuid</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(64)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>channelName</field-name>
      <column-name>channelname</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(128)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>internalTag</field-name>
      <column-name>internaltag</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(128)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>channelValue</field-name>
      <column-name>channelvalue</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(64)</sql-type>

      </cmp-field>
      <cmp-field>
      <field-name>qualData</field-name>
      <column-name>qualdata</column-name>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(16)</sql-type>

      </cmp-field>

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


      </enterprise-beans>


      <ejb-relation>
      <ejb-relation-name>tagmap-ressdests</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>tagmap-has-ressdests</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>externalTagId</field-name>
      <column-name>external_tag_id_fk</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>ressdest-has-tagmap</ejb-relationship-role-name>
      <key-fields/>

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


      </jbosscmp-jdbc>


      the relationship work with dtd 3_0
      someone could help me please ?
      thanks