1 Reply Latest reply on Jul 8, 2002 7:53 PM by Dain Sundstrom

    bug in jboss3.0 cmr

    jawwad Newbie

      Hi all;
      Well i was trying to connect cmr relation ship with oracle ,(Customer has address).it all works fine when i use <create-
      table>true</create-table>.But when i use forein key mapping it gives exception in case when i use of and mainly <create-
      table>false</create-table>.in jbosscmp-jdbc.xml.
      2002-07-06 20:09:58,805 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.AddressEJB] jar:file:/G:/jboss3/server/default/tmp/deploy/server/default/deploy/sh.jar/62.sh.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults
      2002-07-06 20:09:58,875 ERROR [org.jboss.metadata.XmlFileLoader] File file:/G:/jboss3/server/default/tmp/deploy/server/default/deploy/sh.jar/62.sh.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 68. Error message:
      org.xml.sax.SAXParseException: EMPTY content models must have no content.
      at org.apache.crimson.parser.Parser2.error(Parser2.java:3086)
      at org.apache.crimson.parser.ValidatingParser$EmptyValidator.consume(ValidatingParser.java:296)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1311)
      at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)

      //////////////////////////////////////////////////////////
      Also if i remove relationship tag it give me no exception on deployment time but it gives error on client side
      javax.ejb.CreateException: Could not create entity:java.sql.SQLException: ORA-00
      904: invalid column name
      //////////////////////////////////////////////////////////

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

      java:/OracleDS
      <datasource-mapping>Oracle9i</datasource-mapping>

      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>



      <enterprise-beans>

      <ejb-name>CustomerEJB</ejb-name>
      <table-name>customer</table-name>

      <cmp-field>
      <field-name>id</field-name>
      <column-name>USERID</column-name>
      </cmp-field>

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



      <ejb-name>AddressEJB</ejb-name>
      <table-name>address</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>ADDRESSID</column-name>
      </cmp-field>

      <cmp-field>
      <field-name>street</field-name>
      <column-name>STREET</column-name>
      </cmp-field>

      <cmp-field>
      <field-name>city</field-name>
      <column-name>CITY</column-name>
      </cmp-field>

      </enterprise-beans>


      <ejb-relation>
      <ejb-relation-name>Customer-Address</ejb-relation-name>
      <foreign-key-mapping>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer-has-Address</ejb-relationship-role-name>
      <foreign-key-fields>
      <foreign-key-field>
      <field-name>id</field-name>
      <column-name>ADDRESSID</column-name>
      </foreign-key-field>
      </foreign-key-fields>

      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>Address-belongs-to-Customer</ejb-relationship-role-name>
      <foreign-key-fields/>
      </ejb-relationship-role>
      </foreign-key-mapping>
      </ejb-relation>

      </jbosscmp-jdbc>

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

      <ejb-name>CustomerEJB</ejb-name>
      com.ssuet.customer.Customer
      com.ssuet.customer.CustomerHome
      <ejb-class>com.ssuet.customer.CustomerBean</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>Customer</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>name</field-name>
      </cmp-field>

      <primkey-field>id</primkey-field>

      <ejb-local-ref>
      <ejb-ref-name>ejb/AddressHome</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.ssuet.address.AddressHome</local-home>
      com.ssuet.address.Address
      <ejb-link>AddressEJB</ejb-link>
      </ejb-local-ref>





      <ejb-name>AddressEJB</ejb-name>
      com.ssuet.address.Address
      <local-home>com.ssuet.address.AddressHome</local-home>
      <ejb-class>com.ssuet.address.AddressBean</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>Address</abstract-schema-name>

      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>


      <cmp-field>
      <field-name>street</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>city</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>


      </enterprise-beans>


      <!--One-to-one Customer-Address-->
      <ejb-relation>
      <ejb-relation-name>Customer-Address</ejb-relation-name>

      <!--defining relation shipof cstomer-->
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer-has-Address</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>CustomerEJB</ejb-name>
      </relationship-role-source>

      <cmr-field>
      <cmr-field-name>homeAddress</cmr-field-name>
      </cmr-field>

      </ejb-relationship-role>

      <!--defining relation shipof address-->
      <ejb-relationship-role>
      <ejb-relationship-role-name>Address-belongs-to-Customer</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>AddressEJB</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>


      </ejb-jar>
      ////////////////////////////////////////////////
      Will be vey thank ful if some on can find errors. I tried it i think more then 50 times.But no way.