-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to perform an inverse type query?
PostPosted: Sun Jun 05, 2005 1:07 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Hibernate version: 3.0.5

I have an entity object with a property "uniqueID", and I have a list of uniqueIDs, what I would like to do is query the database and find out what uniqueIDs are NOT in the database. Is there an easy way to do this?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 1:13 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
The reason I ask is I know at least one way to do it, would be to do an HQL query that binds a parameter something like "from myclass c where c.uniqueID in :myparam", then bind my list to myparam. However then I have to take the result and then remove every uniqueID from my original list that is in the results to find what ones are not in the database. And there will be a LOT of results... its something I'd ideally like to do in the database.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 4:00 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
An example of what I'm trying to do would be helpful.

Parameter I want to bind to my query: (1,2,3,4,5)

Parameters held in the database: (1,2,3)

So my query is looking for 1-5, the database only has 1-3, so I want it to return the subtraction, which would be (4,5).

Any ideas?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.