1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Join in TopLink

Discussion in 'Oracle Forms and Reports' started by callme_harry, Nov 12, 2008.

  1. callme_harry

    callme_harry Active Member

    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    80
    Hi,


    This is maybe dummy question, but i don't have idea how i can do this.

    Basicly we can view data from database table easly using ADFand EJB-TopLink.

    For example (using HR schema, employee and department table) we can drag employee datacontrol into ADF readonly table.

    But what about if i want to view department name in one table ?

    In short, my problem is similiar like join employee and department table and show the result using ADF table.


    --
    Best Regards

    YM : callme_harry
    Blog : http://harry-christian.blogspot.com
     
  2. sameer

    sameer Forum Advisor

    Messages:
    105
    Likes Received:
    6
    Trophy Points:
    240
    taking the HR schema example you gave, I understand that you have one employee table and department table in a foreign key relationship with employee table having the department ID. In that case you can add a getter method to employees Toplink entity bean.
    Code (Text):

    public String getDeptName() {
    return this.getDepts().getDeptName();
    }
     
    Drag and Drop Employees Method Return and in the generated Data Control, Department Name involved in the primary-foreign key relationship should be available from the Data Control Pallete.

    Hope this helps
     
  3. callme_harry

    callme_harry Active Member

    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    80
    Hai Sameer,


    Nice to know that you've got my point.

    Yes i already tried your solution and works.

    Now my question is :

    Is that dangerous effect or side effect if we modified the POJO's / Entitiy ?
     
  4. sameer

    sameer Forum Advisor

    Messages:
    105
    Likes Received:
    6
    Trophy Points:
    240
    well i am not sure what may happen if you modify the entity. however i believe there should not be a problem when you try to persist
     
  5. callme_harry

    callme_harry Active Member

    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    80
    I found a better solution. I create a new POJO then calling my existing pojo and then publish in datacontrol.

    Like this :

    Code (Text):

    EmployeeView
    {
       Employee emp = new Employee(); // This is the real POJO generated by JDev
       private String name;
       private String departmentName;

       // setter
       ...

       // getter
       public void getName()
       {
          return emp.getName();
       }

       public void getDepartmentName()
       {
          return emp.getDepartment().getDepartmentName();
       }
       
    }
     
    However this is not make sense for me because we must create new Class represent as view. Oracle should handle this because relationship between Employee and Department is already defined.

    Im now asking Shay from OTN and he said we can drag department under employee field but im getting empty result. Im waiting for his reply.

    I'll keep post later.