facebook

parent child relationship

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #231817 Reply

    vinayak12
    Member

    Hi,
    I am using MyEclipse Workbench IDE.
    How can i access child object from parent class. For example i have Parent table and child table. Child table has foreign key relationship with parent.
    When i create hbm files for Parent and Child, in the java object of Child i find getParent method, but dont find any method like getChild from Parent object.
    Can you tell me solution to achive the same or any work around to generate java objects.

    Thanks
    Vinayak

    #231824

    Riyad Kalla
    Member

    Vinayak,
    Is this a o2o relationship? 1 Parent only ever has 1 child? In that case, you can add a FK to both tables pointing to eachother (I believe) and then you should get 2 properties (getParent and getChild) that point at eachother. However, if the parent can have more than one child, I would suggest adding custom code to the concrete generated class (not the abstract class) that will retrieve the children and return them. Although IIRC, a o2m relationship should generate this property for you…

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: parent child relationship

You must be logged in to post in the forum log in