-->
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: Getting sliced one2many relation
PostPosted: Thu Apr 15, 2010 3:56 am 
Newbie

Joined: Wed Mar 10, 2010 7:16 am
Posts: 7
Hi, having some one2may or many2many relation, and having mapped it to hibernate as sets or any other way I need to get these relations in a sliced mode, I mean, in case there are a lot of related entities (millions) I want to get one range (30-60).

I would do that with startIndex and endIndex If I knew the query to do, but from hibernate API I do not know the joining fields. (It is a requirement, as I am working on a software library that gets a connection object and works on mapped classes with no previous knowledge of the classes, I cannot hardcode fields or classes or relations to build the "where", I get class information from ClassMapping object, obtained fromgetAllClassMetadata).

I do not know how would an hibernate expert do it. I am researching on two ways.
1) Some way to use limits in the mapped entity class get method
2) Trying to get the query hibernate uses on 1) so I can do a common query in which I can apply limits.

I also tried getTableMappings to get DB info, but as I can get FKs information they are DB level relations, not class level relations and did not help. Neither did I manage to map DB fields to attribute fields. This would probably help too. I also thought of reading xml config files to map DB fields to attributes and convert in these way DB relations to class relations and make the query, but this do not seems very smart.

Thanks beforehand, I am stucked with this problem for three days and I do not see the way.

Thanks again,
txemi.


Top
 Profile  
 
 Post subject: Re: Getting sliced one2many relation
PostPosted: Thu Apr 15, 2010 4:39 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Have you checked the last example in section 10.4.2? http://docs.jboss.org/hibernate/stable/ ... -filtering


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.