0 Replies Latest reply: Apr 4, 2013 4:41 AM by mhbbb RSS

    Complex master detail use case

      Hi All
      I am using Jdeveloper 11g R2 ( & Weblogic

      In a use case I require to implement a master detail relationship .below is my table scripts

      create table address (oid number primary key , line1 Varchar2(10),line2 Varchar2(10),hashcode Varchar2(10));

      create table person (oid number primary key,addressoid number , personname Varchar2(10));

      ALTER TABLE person
      add CONSTRAINT fkaddress
      FOREIGN KEY (addressoid)
      REFERENCES address (oid);

      When I inserting into address I generate a hash code based on line1 and line2 fields and insert it in hashcode in address table and then insert person as detail

      Assuming below information for first insert , it is working fine

      Address row : oid = 1 ,line1 = 12 Test St ,line 2 = NY ,hashcode = 123
      Person row : oid = 1 ,addressoid = 1 , personname = John
      Next time user entering '12 Test St NY' based on my business role I should not create a new record in Address table but
      use Row with Address oid = 1 and link new person to that (hashcode is used to check that address record is already in DB)

      Any ideas how I implement it in an ADF page pretending a usual insert?

      Appreciate your comments