Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1214

Incorrect data source used loading relationship field

    XMLWordPrintable

Details

    Description

      SourceForge Submitter: bgeddes .
      Running Windows 2000, JDK 1.4.2_02, Jboss 3.2.6

      I have a relationship between two EJBs associated with
      different data sources. When I update the
      relationship, it runs a select statement for the
      foreign key column being updated, but it runs it using
      the datasource for the related ejb. This causes an
      oracle error (ORA-00942: table or view does not exist),
      since the table does not exist in the other schema.

      InventoryMapEJB: datasource1
      StatusEJB: datasource2

      inventoryMapEJB.setStatus(statusEJB);

      This runs: "SELECT inventory_map_id, status_id FROM
      INVENTORY_MAP WHERE (inventory_map_id=?)" using datasource2

      I believe the problem is in the resolveRelationship
      method of the JDBCCMRFieldBridge class. It checks
      hasForeignKey() in order to decide which dataSource to
      use, but the foreignKeyFields member variable hasn't
      been initialized yet. This happens later in the
      method, during the call to
      initializeForeignKeyFields(). The attached file is a
      proposed fix to this class. I just moved dataSource
      and table name loading to after where the foreign key
      fields are initialized.

      Attachments

        Activity

          People

            olubyans@redhat.com Alexey Loubyansky
            sourceforge-user SourceForge legacy user (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: