5 Replies Latest reply on Dec 3, 2001 1:23 PM by Dain Sundstrom

    How to create jbosscmp-jdbc.xml?

    Daniele Newbie

      I'd like to use the CMP2 for my Bean. I use jboss3 alpha. I read in the documentation that u must create the jbosscmp-jdbc.xml but it doesn't explain hot to do!!
      Can u give me a simple Entity Bean CMP 2.0 example!!
      Please help me.
      I use jboss3.0.0 alpha version.

      Another question:
      I don't understanf how I can set another DBMS!! Thanks

      dani






        • 1. Re: How to create jbosscmp-jdbc.xml?
          Jörg Pensel Newbie

          Hi,
          i have a very small example doing some member to column
          and relation mappings.
          I hope this will help.

          Bye Joerg


          <?xml version="1.0" encoding="ISO-8859-1"?>
          <jbosscmp-jdbc>
          <enterprise-beans>
          <entity>
          <ejb-name>Bean1</ejb-name>
          <table-name>Table1</table-name>
          </entity>
          <entity>
          <ejb-name>Bean2</ejb-name>
          <table-name>Table2</table-name>
          </entity>
          <entity>
          <ejb-name>SurrogateBean</ejb-name>
          <table-name>Surrogate</table-name>
          <cmp-field>
          <field-name>id</field-name>
          <column-name>Id</column-name>
          </cmp-field>
          <cmp-field>
          <field-name>current</field-name>
          <column-name>Num</column-name>
          </cmp-field>
          <cmp-field>
          <field-name>dummy</field-name>
          <column-name>Char200</column-name>
          </cmp-field>
          </entity>
          </enterprise-beans>
          <relationships>
          <ejb-relation>
          <ejb-relation-name>DocInfo_DocSysInfo</ejb-relation-name>
          <foreign-key-mapping>
          <ejb-relationship-role>
          <ejb-relationship-role-name>Bean1</ejb-relationship-role-name>
          <foreign-key-fields />
          </ejb-relationship-role>
          <ejb-relationship-role>
          <ejb-relationship-role-name>Bean2</ejb-relationship-role-name>
          <foreign-key-fields>
          <foreign-key-field>
          <field-name>id</field-name>
          </foreign-key-field>
          </foreign-key-fields>
          </ejb-relationship-role>
          </foreign-key-mapping>
          </ejb-relation>
          </relationships>
          </jbosscmp-jdbc>

          • 3. Re: How to create jbosscmp-jdbc.xml?
            Daniele Newbie

            thanks..but I try to make an example and the server doesn't deploy mu EJB!!
            How many deployment descriptor must I create???
            Please can u send me a complete very simple example, only 1 bean for example, with the source code!! thanks
            dani

            • 4. Re: How to create jbosscmp-jdbc.xml?
              David Jencks Master

              I think you don't need one for simple examples. You might check the dtd: you probably have to get it from cvs under jboss/src/resources/org/jboss/metadata (if I remember correctly).

              • 5. Re: How to create jbosscmp-jdbc.xml?
                Dain Sundstrom Master

                There is an example included in the JBossCMP workbook.

                The dtd that David mentioned applies to the current cvs source, and will not always work with the alpha. The dtd was written a couple of weeks after the alpha was released.

                -dain