-->
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: Performance of queries with many selection criteria
PostPosted: Thu Mar 16, 2006 7:12 pm 
Newbie

Joined: Thu Mar 16, 2006 6:31 pm
Posts: 1
Location: UCSF
Hello,

I have a question about the use of hibernate queries for a database intensive bioinformatics application. I am completely new to hibernate, so bear with me (I did look through the hibernate docs, though, and didn't see an answer to my question).

I am facing a situation in which I have to query for several thousand genes from a database of (potentially) several million records. Each gene will have a unique identifier that I can use as a selection criterion, but the sets of genes will change from case to case, and in each case I will have to specify all ~1000-10000 of them.

For example, let’s say for simplicity sake that the gene ID’s are numbers from 1 to 10000. In a real world situation, the numbers would not be continuously incremental like this, so I can’t just select for ID’s that are >0 and <=10000. The sql query might look like:

SELECT Annotation.Value FROM AnnotationTable WHERE Gene.ID IN (1,2,3,4,5 …. 9999, 10000);

Is there a way of performing this kind of query using hibernate objects such that it returns the query results in a reasonable amount of time?

Thanks,

Chris Kingsley
UCSF Cancer Center


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 11:06 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
For queries like this, where no mapped objects have to be created, then yes, Hibernate is just as fast as using plain old jdbc, and the java code would be much simpler than anything jdbc would let you get away with:

Mapping file:
Code:
<query name="AnnotationValues">
    select a.value from AnnotationClass a where geneid in (:GeneIDList)
</query>

Java code:
Code:
Query qry = session.findNamedQuery("AnnotationValues");
qry.setParameterList("GeneIDList", listGeneIds);
return qry.list();
This will return a List<String> (assuming that value is a String property).


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.