1 Reply Latest reply on Nov 30, 2012 9:04 AM by user404

    ADF Master Detail Page

      Hi ,
      I am facing an issue with the master detail page. The page is meant for entring master detial information. The page has two view objects based on entity objects which are based upon the master and detail tables.

      I am using the Jdeveloper version ( Jdeveloper 11g release 2). on Windows 7 on the embedded weblogic server ( included in the jdeveloper).

      Structure of Master and Detail Table are

      Master (pk1,attr1,attr2);

      Detail (pk1,pk2,attr1,attr2);

      The detail table is having a composite primary key in which pk1 is a foreign key and pk2 is incremented for each pk1, hence the value is like (1,1), (1,2),(1,3) ... etc.

      Now i have created a create insert operation in the page from the detail view object. And for generating the new pk2 value in the detail row i have written the logic in the doDML() method of the detail entity object.
          protected void doDML(int operation, TransactionEvent e) {
              if (operation == DML_INSERT) {
                      DBTransaction trans = getDBTransaction(); 
                      String sql = "select max(nvl(pk2,0))+1 from xyz_detail where pk1="+this.getPk1().toString();
                      PreparedStatement pstmt =trans.createPreparedStatement(sql,0);
                      ResultSet rs = pstmt.executeQuery();
                      } catch (SQLException excp){
                              System.out.println("Inside exception");
              super.doDML(operation, e);
      Now , when i am creating a single record and commiting the transaction the value of the pk2 in detail is generated and saved properly, how ever when i am generating multiple rows at once and then commitng the transaction noting is being done, neither the value of pk2 is being generated nor the rows afre commited please guide me accordingly.

      May be the answer of this question be in the behaviour of DBTransation , i am creating multiple rows and the calling the #{bindings.commit.execute} , what is the behaviuor of this commit, i think it should commit all the uncommited work, and apart from this as the logic is written in the doDML() method it must fire for every row of data created in detail once.

      Please Guide me accordingly.