-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Loosely Coupled Parent - Child Relationship
PostPosted: Mon Oct 25, 2004 5:48 am 
Newbie

Joined: Mon Oct 25, 2004 5:15 am
Posts: 1
Hi all,

Using the examples in the documentation I can easily create a parent/child realtionship with Hibernate (in my case it's an album that has many photos). No problem.

However, in all the examples the parent and/or the child have an explicit knowledge of each other, e.g. the parent Java object has a property for the child. I would like to avoid this because

- I want to control how many children are loaded
In my application I want to page through the children rather than getting all children in one go. If I have a property in the parent object I can't do that except if I use the lazy loading feature of Hibernate.

- I don't want to use the lazy loading feature of Hibernate
I'm hiding Hibernate behind a DAO pattern and plan to support a mail server based access to my albums as well. Since I can't simulate the lazy loading feature with my mail server I don't want to use it. The DAO pattern is about abstracting the access to my objects and if I use a feature that is only supported by Hibernate this abstraction level is of no use to me. In addition I would like to use my POJOs independently of Hibernate.

Basically what I would like to have is Album and Photo classes that don't know of each other but Hibernate still managing the association between themin the database.

Is this possible to do? Am I think to difficult here and there is an easier solution to page through child classes? Paging should be a common problem.

Thanks for your help,
Claus


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.