3 Replies Latest reply on Oct 5, 2001 7:55 PM by Ignacio

    Any jbosscmp-jdbc.xml example out there?

    Ignacio Newbie

      Hi, I have been looking at how to implement the CMP 2.0 in JBoss 2.5, and have one question: examples?

      I mean, I have written a jbosscmp-jdbc file myself following the (scarce) indications at the respect, but I thought that it replaced the jaws.xml file (because it has the same structure, plus some tags). Should I understand that jaws.xml file is still needed? Anyone has an example of a config file for CMP 2.0?

      I know it's still in alpha, but wanted to test it anyway =)

        • 1. Re: Any jbosscmp-jdbc.xml example out there?
          Ignacio Newbie

          Ok, please stop replying to mi message, you noisy crowd ;)

          There is one "example" in the conf/default directory, named standardjbosscmp-jdbc.xml

          If you adhere to the same sintax and think a bit on your own the rest is easy.

          And it's only 22:34 in my local time - tonight I'm gonna sleep :)))

          • 2. Re: Any jbosscmp-jdbc.xml example out there?
            David Budworth Newbie

            So, any possiblity of sharing the magic trick to this?

            I can get all my beans to deploy, but only as long as there are no CMR fields. If I have the CMR descriptions in ejb-jar.xml, jboss chokes at deployment time at JDBCRelationshipRoleMetaData.java:95
            with a null pointer.

            I also removed jaws.xml, and it seems to be ok, though oddly enough, my beans deploy without error, even though I have yet to add the data source they reference.

            So I have jbosscmp-jdbc.jar, ejb-jar.xml, and jboss.xml.

            Do relations HAVE to be declared in jbosscmp-jdbc.jar? The docs say no.

            Could you possibly provide the relation bits from the xml files?

            Or, did you not do CMR yet? And were only trying to deploy ejb2 beans?

            • 3. Re: Any jbosscmp-jdbc.xml example out there?
              Ignacio Newbie

              search on the forums, there are examples of many-2-many and one-2-many relations.

              You don't need to specify the fields in jbosscmp-jdbc, but then the database column names are generated automatically (let jboss generate your tables to see the names chosen). You have to specify them on jbosscmp-jdbc.xml to force your names.

              On ejb-jar:
              ...
              </enterprise-beans>



              <!-- Albaran -->
              <ejb-relation>
              <ejb-relation-name>Albaran-LineaAlbaran</ejb-relation-name>
              <ejb-relationship-role>
              <ejb-relationship-role-name>Albaran-has-LineaAlbaran</ejb-relationship-role-name>
              One
              <relationship-role-source>
              <ejb-name>Albaran</ejb-name>
              </relationship-role-source>
              <cmr-field>
              <cmr-field-name>lineasAlbaran</cmr-field-name>
              <cmr-field-type>java.util.Collection</cmr-field-type>
              </cmr-field>
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>LineaAlbaran-belongsto-Albaran</ejb-relationship-role-name>
              Many
              <relationship-role-source>
              <ejb-name>LineaAlbaran</ejb-name>
              </relationship-role-source>
              <cmr-field>
              <cmr-field-name>albaran</cmr-field-name>
              </cmr-field>
              </ejb-relationship-role>
              </ejb-relation>

              ...

              On jbosscmp-jdbc:
              ...
              </enterprise-beans>



              <!-- Albaran -->
              <ejb-relation>
              <ejb-relation-name>Albaran-LineaAlbaran</ejb-relation-name>
              <foreign-key-mapping>
              <ejb-relationship-role>
              <ejb-relationship-role-name>Albaran-has-LineaAlbaran</ejb-relationship-role-name>
              <foreign-key-fields/>
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>LineaAlbaran-belongsto-Albaran</ejb-relationship-role-name>
              <foreign-key-fields>
              <foreign-key-field>
              <field-name>id</field-name>
              <column-name>ALB_ID</column-name>
              </foreign-key-field>
              </foreign-key-fields>
              </ejb-relationship-role>
              </foreign-key-mapping>
              </ejb-relation>

              ...