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: How to speed up collection loading
PostPosted: Tue Sep 04, 2007 10:05 am 
Newbie

Joined: Fri Jan 19, 2007 11:29 am
Posts: 2
Location: Russia
In my application I have lazy collections.
I load ALL objects from database.

Consider standard parent-child example:
<class entity-name="Placement" abstract="false" lazy="false" discriminator-value="Placement" table="`placement`">
...
<many-to-one name="owner" entity-name="Placement" cascade="merge,persist,save-update,lock,refresh" lazy="false" insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`owner_id`"/>
</many-to-one>
<bag name="children" fetch="subselect" lazy="true" cascade="merge,persist,save-update,lock,refresh" inverse="true">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="Placement"/>
</bag>
...
</class>
I begin transaction.
First I read all placements into session. Then I touch placement.children. Really all information needed to instantiate placement.children collections is in session. But hibernate issues separate select to instantiate them - it's OK.

Then I commit transaction.

The same situation is for another relations: elements of collections are in session but hibernate issues complicated selects to instantiate them.

Really for my application loading time is not optimal it is can be optimized by means of smart placement.children collection loading.

The question is:
Is it possible to configure hibernate that it loads only ids of elements in collection and then looks up elements by id in session?

Thanks in advance.

PS: the second-level cache is not solution for me: I need to speed up time of initial loading of big amount of data.


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.