0

I have the following table structure and I want a turn the query into a NH criteria but I'm not sure how to incorporate the correct 'Projection', does anyone know how?

alt text

And the query I want to turn into a Criteria:

select ComponentId from Table_1
where [Name] = 'Contact' or [Name] = 'CurrencyPair'
group by ComponentId
having count(VersionId) = 2
Community
  • 1
  • 1
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152

1 Answers1

1

I came across this question when trying to find a solution to my problem.

This post was useful.

In my case I was trying to return all records which have all the sub records the user specifies. I ended up using a sub query which filters the sub records to the ones the user specified and returns the count, and checking that the count of the sub query equals the number of sub records the user specified. Bit different from your scenario, but hope helps.

Ian
  • 1,619
  • 1
  • 14
  • 23
  • 1
    See also http://stackoverflow.com/questions/467172/hibernate-criteria-api-having-clause-work-arounds – Ian Dec 20 '10 at 12:50