-->
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: LAZY fetching
PostPosted: Sun Jul 04, 2010 9:53 am 
Newbie

Joined: Sun Jul 04, 2010 9:23 am
Posts: 1
hi,
I have an object with some other objects related to it with the "one-to-many" relation.
These mappings have fetchType=EAGER and fetchMode=SUBSELECT.

Code:
@OneToMany(mappedBy = "id.object", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @Fetch(value = FetchMode.SUBSELECT)
    @Cache(region = "business", usage = CacheConcurrencyStrategy.READ_WRITE)
    public Collection<ObjectChild> getObjectChild() {
        return objectChild;
    }


It's a very large application that uses this object for years, so I can't change those fetch modes.
But, there is one case that I need the LAZY fetching:
I want to select the major object with only two other related collections.

Now, when I use the Criteria or HQL APIs, hibernate generates a lot of queries to select all the objects that are related to my major object.

( I can't use a "Named Query" because I have criteria I should add to the query.)

What can I do in order to select only the objects want to select?

Thanks a lot


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.