-->
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: Get records with matching values and element collection vals
PostPosted: Tue Dec 07, 2010 7:53 am 
Beginner
Beginner

Joined: Tue Nov 02, 2010 4:29 am
Posts: 21
I need to find value duplicate count in the database use an HQL query instead of reading in an iterating over lots of objects.
The query should only count records whose field values match.
It should compare all but a specified list of fields. This will allow the developer to tell it to ignore things like the id, version and relationship fields.
Importantly this will not include embedded element collections. Is the following a correct approach?

Code:
select count(*) from Entity where valueField1 = vf1 and valueField2 = vf2 and elementCollection1 = ec1


Where vf1, vf2 and ec1 have been taken from the object to get the value duplicate count of.

As an aside is there anyway of specifying which fields to ignore instead of which to include.


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.