4 Replies Latest reply on Mar 8, 2002 6:40 PM by zerosleep

    Load relation failed Embedded Exception Table not found

    zerosleep

      I have a one-many unidirectional relationship setup between to two tables, two beans. I finally was able to get everything setup correctly in JBoss 3 Beta 2 and when I tried to add a bean from the many side to the Collection on the one side. I got the following error:

      Load relation failed Embedded Exception Table not found: HOLES in statement [SELECT course_id, id FROM holes WHERE (course_id=11) OR (course_id=12) OR (course_id=14)]; nested exception is: javax.ejb.EJBException: Load relation failed Embedded Exception Table not found: HOLES in statement [SELECT course_id, id FROM holes WHERE (course_id=11) OR (course_id=12) OR (course_id=14)]

      Now this doesn't make much sense to me because I KNOW the table exists and the SQL that jboss is using looks fine.

      By commenting out the part of the code where I add the bean to the collection, I'm still able to create the bean and it shows as created in the table that jboss says doesn't exist. What could be the problem?

      my jbosscmp-jdbc file:


      <ejb-relation>
      <ejb-relation-name>Course-CourseHoles</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>

      <ejb-relationship-role-name>Course-has-many-CourseHoles</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>id</field-name>
      <column-name>course_id</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>CourseHole-belongs-to-Course</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>


      my ejb-jar.xml file:


      <ejb-relation>
      <ejb-relation-name>Course-CourseHoles</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Course-has-many-CourseHoles</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>CourseEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>courseHoles</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>CourseHole-belongs-to-Course</ejb-relationship-role-name>
      Many
      <cascade-delete/>
      <relationship-role-source>
      <ejb-name>CourseHoleEJB</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

        • 1. Re: Load relation failed Embedded Exception Table not found
          dsundstrom

          Did you specify the datasource?

          Try letting JBossCMP create your tables.

          • 2. Re: Load relation failed Embedded Exception Table not found
            zerosleep

            Yes, I'm using PostgreSQL 7.2.

            I'll remove the ds link and let you know if it works.

            • 3. Re: Load relation failed Embedded Exception Table not found
              zerosleep

              Dain,

              I get the following error with my one-many uni relationship:

              Role: CourseHole-belongs-to-Course with multiplicity many using foreign-key mapping is not allowed to have key-fields

              Why is this so? I was under the impression that if Table B is a child to Table A and my EJB for table A has many of EJBs from Table B I would be able to use key-fields in the B-belongs-to-A role.

              Here is an example of what I THOUGHT was a proper one-many relation:


              <ejb-relation>
              <foreign-key-mapping/>

              <ejb-relation-name>A-B-Relationship</ejb-relation-name>

              <ejb-relationship-role>
              <ejb-relationship-role-name>A-has-many-of-B</ejb-relationship-role-name>
              </ejb-relationship-role>

              <ejb-relationship-role>
              <ejb-relationship-role-name>B-belongs-to-A</ejb-relationship-role-name>
              <key-fields>
              <key-field>
              <field-name>A-primary-key</field-name>
              <column-name>B-foreign-key-to-A</column-name>
              </key-field>
              </key-fields>
              </ejb-relationship-role>

              </ejb-relation>


              Maybe this is bug, but I'm more likely to believe this is something I'm doing wrong since I'm 3 months new to EJBs.

              • 4. Re: Load relation failed Embedded Exception Table not found
                zerosleep

                I'm such an idiot sometimes. I had declared the DS in EVERY single section but I hadn't overrided the with the same datasource. Grrrrr! Sorry for wasting your time with this Dain.