-->
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: Hibernate Eager Doesn't in JPA
PostPosted: Mon Nov 16, 2009 6:32 pm 
Beginner
Beginner

Joined: Thu Jul 31, 2008 8:28 pm
Posts: 24
Hi,
I have an EJB3 application written with JPA and using Hibernate as the JPA provider.
I have rich object graph which built from entities each has it's own table.
For example I have Process, which has collection of Activity which in turn has collection of Participant which in turn has collection of Elements.

When I select a process I would also like to eagerly select all the other related entities like Activity, Participant and Element. I have set the featch value of the OneToMany annotation to be EARER but yet hibernate issue select statement for each entity.

My database is pretty small (20 MB) but yet selecting two processes, each has about 30 activities each with 2 participants each with 2 elements table about 2-20 seconds.
I'm using SQL Server Express as back-end and I've try to select the information manually and it was very fast - I think the problem is in the multiple statements.
I've also try to use BatchSize annotation which reduce the number of statements from 460 to 100 but remain equally slow.

How can I make sure hibernate eagerly select the whole entities in fewer statements possible - preferably one statement. I'm ready to build HQL query specifically for this select but I need it to be faster.

Thank you,
Ido.


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.