9 Replies Latest reply on Dec 12, 2003 10:46 AM by martin0

    ex06_3

    arun_reddy

       

      "Arun_Reddy" wrote:
      "Arun_Reddy" wrote:
      In weblogic specific file , there is additional information about the relationship . This gives the container information about how to join the 2 tables.
      In jboss specific file I do not find this kind of information. So I am not sure the 2 tables will be joined. Could some body explain me.
      Partical content of weblogic file is given below.
      Thanks.

      <weblogic-rdbms-relation>
      <relation-name>Customer-Address</relation-name>
      <weblogic-relationship-role>
      <relationship-role-name>Customer-has-a-Address</relationship-role-name>
      <column-map>
      <foreign-key-column>ADDRESS_ID</foreign-key-column>
      <key-column>ID</key-column>
      </column-map>
      </weblogic-relationship-role>
      </weblogic-rdbms-relation>


        • 1. Re: ex06_3
          bill.burke

           

          "Bill Burke" wrote:
          "Bill Burke" wrote:
          Yes this is more advanced configuration. The final version of book will have more info on this. Until then, buy the JBoss CMP 2.0 docs from the website.

          > In weblogic specific file , there is additional
          > information about the relationship . This gives the
          > container information about how to join the 2
          > tables.
          > In jboss specific file I do not find this kind of
          > information. So I am not sure the 2 tables will be
          > joined. Could some body explain me.
          > Partical content of weblogic file is given below.
          > Thanks.
          >
          > <weblogic-rdbms-relation>
          > <relation-name>Customer-Address</relation-name>
          > <weblogic-relationship-role>
          >
          >
          >
          >
          >
          >
          >
          > <relationship-role-name>Customer-has-a-Address</relat
          > onship-role-name>
          > <column-map>
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          > <foreign-key-column>ADDRESS_ID</foreign-key-column>
          > <key-column>ID</key-column>
          > </column-map>
          > </weblogic-relationship-role>
          > </weblogic-rdbms-relation>



          • 2. Re: ex06_3
            bazza

             

            "bazza" wrote:
            "bazza" wrote:
            I have just tried this example on jboss-3.2.2RC4 and it
            fails to deploy complaining about the CustomerBean not having a local-home. Defining CustomerLocal and CustomerHomeLocal does the trick! But why does it need these interfaces to be defined?
            -Barry


            • 3. Re: ex06_3
              podescrermeu

               

              "podescrermeu" wrote:
              "podescrermeu" wrote:
              Hello!

              I have the exact same problem!
              The erros code is:
              org.jboss.deployment.DeploymentException: CustomerEJB has no local home interface.

              Greetings,
              David


              • 4. Re: ex06_3
                pjo2003

                 

                "pjo2003" wrote:
                "pjo2003" wrote:
                How do you write the CustomerHomeLocal interface?
                And with what methods?

                Thanks


                • 5. Re: ex06_3

                   

                  "bferro" wrote:
                  "bferro" wrote:
                  I hope that some of the authors of the book might answer to this problem.
                  Indeed, exercise 6.3 does not deploy correctly in JBoss 3.22, unless you define a local and a local home interface for Customer Bean.
                  But from the point of view of the bean developer, there is no "obligation" to define such local interfaces.
                  Customer has both remote interfaces (remote and home) such that a remote client can have access to it.
                  Address Bean has the proper local interfaces and Customer uses it properly.
                  But nowhere is written that maybe the CMP Engine might need local interfaces for Customer Bean, to be able to join both tables.
                  That is what I want to know. I have read the full CMP Engine documentation for JBoss 3.22, and nothing is there concerning this problem.

                  Again the problem is not how to write the local interfaces for Customer Bean. If you write them down everything works fine. THE PROBLEM IS WHY SHOUD YOU WRITE SUCH LOCAL INTERFACES FOR CUSTOMER BEAN.
                  Regards,
                  Jorge
                  Jorge



                  • 6. Re: ex06_3
                    martin0

                     

                    "Martin0" wrote:
                    "Martin0" wrote:
                    Glad I found this thread - I just posted the same in the newbie forum!!

                    Perhaps 3.2.3 will fix it???

                    Martin


                    • 7. Re: ex06_3
                      martin0

                       

                      "Martin0" wrote:
                      "Martin0" wrote:
                      Here are some links that seems relevant:
                      http://sourceforge.net/tracker/?group_id=22866&atid=376685&func=detail&aid=544778


                      • 8. Re: ex06_3
                        martin0

                         

                        "Martin0" wrote:
                        "Martin0" wrote:
                        I've submitted a bug on sourceforge for this.

                        https://sourceforge.net/tracker/index.php?func=detail&aid=855935&group_id=22866&atid=376685


                        • 9. Re: ex06_3
                          martin0

                           

                          "Martin0" wrote:
                          "Martin0" wrote:
                          Fails with jboss 3.2.3 aswell.

                          For the record the deployment descriptors are included below:
                          ejb-jar.xml
                          <?xml version="1.0"?>

                          <!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>
                          <entity>
                          <ejb-name>CustomerEJB</ejb-name>
                          <home>com.titan.customer.CustomerHomeRemote</home>
                          <remote>com.titan.customer.CustomerRemote</remote>
                          <ejb-class>com.titan.customer.CustomerBean</ejb-class>
                          <persistence-type>Container</persistence-type>
                          <prim-key-class>java.lang.Integer</prim-key-class>
                          <reentrant>False</reentrant>
                          <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>lastName</field-name></cmp-field>
                          <cmp-field><field-name>firstName</field-name></cmp-field>
                          <cmp-field><field-name>hasGoodCredit</field-name></cmp-field>
                          <primkey-field>id</primkey-field>
                          <security-identity><use-caller-identity/></security-identity>
                          </entity>
                          <entity>
                          <ejb-name>AddressEJB</ejb-name>
                          <local-home>com.titan.address.AddressHomeLocal</local-home>
                          <local>com.titan.address.AddressLocal</local>
                          <ejb-class>com.titan.address.AddressBean</ejb-class>
                          <persistence-type>Container</persistence-type>
                          <prim-key-class>java.lang.Integer</prim-key-class>
                          <reentrant>False</reentrant>
                          <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>
                          <cmp-field><field-name>state</field-name></cmp-field>
                          <cmp-field><field-name>zip</field-name></cmp-field>
                          <primkey-field>id</primkey-field>
                          <security-identity><use-caller-identity/></security-identity>
                          </entity>
                          </enterprise-beans>

                          <relationships>
                          <ejb-relation>
                          <ejb-relation-name>Customer-Address</ejb-relation-name>
                          <ejb-relationship-role>
                          <ejb-relationship-role-name>Customer-has-a-Address</ejb-relationship-role-name>
                          <multiplicity>One</multiplicity>
                          <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>
                          <ejb-relationship-role>
                          <ejb-relationship-role-name>Address-belongs-to-Customer</ejb-relationship-role-name>
                          <multiplicity>One</multiplicity>
                          <relationship-role-source>
                          <ejb-name>AddressEJB</ejb-name>
                          </relationship-role-source>
                          </ejb-relationship-role>
                          </ejb-relation>
                          </relationships>

                          <assembly-descriptor>
                          <security-role>
                          <role-name>Employees</role-name>
                          </security-role>
                          <method-permission>
                          <role-name>Employees</role-name>
                          <method>
                          <ejb-name>CustomerEJB</ejb-name>
                          <method-name>*</method-name>
                          </method>
                          <method>
                          <ejb-name>AddressEJB</ejb-name>
                          <method-name>*</method-name>
                          </method>
                          </method-permission>
                          <container-transaction>
                          <method>
                          <ejb-name>CustomerEJB</ejb-name>
                          <method-name>*</method-name>
                          </method>
                          <method>
                          <ejb-name>AddressEJB</ejb-name>
                          <method-name>*</method-name>
                          </method>
                          <trans-attribute>Required</trans-attribute>
                          </container-transaction>
                          </assembly-descriptor>

                          </ejb-jar>



                          jboss.xml:
                          <?xml version="1.0"?>

                          <jboss>
                          <enterprise-beans>
                          <entity>
                          <ejb-name>CustomerEJB</ejb-name>
                          <jndi-name>CustomerHomeRemote</jndi-name>
                          </entity>
                          <entity>
                          <ejb-name>AddressEJB</ejb-name>
                          <local-jndi-name>AddressHomeLocal</local-jndi-name>
                          </entity>
                          </enterprise-beans>
                          </jboss>

                          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>

                          <defaults>
                          <datasource>java:/DefaultDS</datasource>
                          <datasource-mapping>Hypersonic SQL</datasource-mapping>
                          <create-table>true</create-table>
                          <remove-table>true</remove-table>
                          </defaults>

                          <enterprise-beans>
                          <entity>
                          <ejb-name>CustomerEJB</ejb-name>
                          <table-name>Customer</table-name>
                          <cmp-field>
                          <field-name>id</field-name>
                          <column-name>ID</column-name>
                          </cmp-field>
                          <cmp-field>
                          <field-name>lastName</field-name>
                          <column-name>LAST_NAME</column-name>
                          </cmp-field>
                          <cmp-field>
                          <field-name>firstName</field-name>
                          <column-name>FIRST_NAME</column-name>
                          </cmp-field>
                          <cmp-field>
                          <field-name>hasGoodCredit</field-name>
                          <column-name>HAS_GOOD_CREDIT</column-name>
                          </cmp-field>
                          </entity>
                          <entity>
                          <ejb-name>AddressEJB</ejb-name>
                          <table-name>Address</table-name>
                          <cmp-field>
                          <field-name>id</field-name>
                          <column-name>ID</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>
                          <cmp-field>
                          <field-name>state</field-name>
                          <column-name>STATE</column-name>
                          </cmp-field>
                          <cmp-field>
                          <field-name>zip</field-name>
                          <column-name>ZIP</column-name>
                          </cmp-field>
                          </entity>
                          </enterprise-beans>
                          <relationships>
                          <ejb-relation>
                          <ejb-relation-name>Customer-Address</ejb-relation-name>
                          <foreign-key-mapping/>
                          <ejb-relationship-role>
                          <ejb-relationship-role-name>Customer-has-a-Address</ejb-relationship-role-name>
                          <key-fields/>
                          </ejb-relationship-role>
                          <ejb-relationship-role>
                          <ejb-relationship-role-name>Address-belongs-to-Customer</ejb-relationship-role-name>
                          <key-fields>
                          <key-field>
                          <field-name>id</field-name>
                          <column-name>HOME_ADDRESS</column-name>
                          </key-field>
                          </key-fields>
                          </ejb-relationship-role>
                          </ejb-relation>
                          </relationships>
                          </jbosscmp-jdbc>