-->
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.  [ 2 posts ] 
Author Message
 Post subject: Lazy loading issue
PostPosted: Wed Sep 22, 2004 5:32 pm 
Newbie

Joined: Wed Sep 22, 2004 4:50 pm
Posts: 1
Hello,

I'm having an issue with lazy loading of collections. We have created some collection implementations for use in our hibernate objects mainly to enforce type safety in collections, and to maintain bi-directional references. Let me give an example:

Contained in class blah.Parent:
Code:
/**
   * @hibernate.set table="CHILDREN" lazy="true" cascade="all" inverse="true"
   * @hibernate.collection-key  column="COLLECTION_ID"
   * @hibernate.collection-one-to-many class="blah.Child"
   * @return Set
   */
  public Set getChildren() {
    return children;
  }

protected void setChildren(Set children) {
    this.children= new CfSet(Child.class, children, new ChildCallback());
  }



This obviously has the unwanted effect of overriding lazy initialization:

Code:
select p from blah.Parent p


results in not only selects against the PARENTS table, but the CHILDREN table as well. If I change the setChildren method to

Code:
protected void setChildren(Set children) {
    this.children= children;
  }


selects are only executed against the PARENTS table.

Is there any work around that would allow us to use our collection implementations while still allowing lazy loading to work as expected?

-Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 8:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, you can extend Hibernate's collections framework.


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

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.