Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1090115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:19:26+00:00 2026-05-16T23:19:26+00:00

hey guys, I’m using NHibernate version 2.1.2.4000. The Entity class bowl { int id

  • 0

hey guys, I’m using NHibernate version 2.1.2.4000.

The Entity

class bowl
{
    int id { get; set; }
    List<fruit> fruits { get; set; }
}

The Desired (pseudo) Query

var bowls = repository.where(b => b.fruits.count > 1);

The Question

How do I do the above query using the NHibernate criteria API?

Ideally I’d like to be able to do something like this (no subqueries, no detached criterias):

var bowls = repository.where(Restrictions.Gt("fruits.count", 1));

Is the above possible somehow?

cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:19:26+00:00Added an answer on May 16, 2026 at 11:19 pm

    It’s only possible with detached criteria.

    On the other hand, filtering by “count” is very easy using HQL:

    from bowl where fruits.size > 1
    

    Criteria API is not as powerful as HQL. Unfortunately, all this linq-style API’s are based on criteria.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I want to store a categorized list of URLs. This is an
Hey Guys, here is my code for this, the only help i get from
Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Hey guys, given a data set in plain text such as the following: ==Events==
Hey guys I was wondering if there is a way to get a certain
Hey guys I have about 8 fieldSets and Im iterating over a list. I
Hey guys, I'm trying to get my head around LINQ and FP, so forgive
Hey guys I am making a terminal application using Swing and Apache Commons. I
Hey guys I managed to get a text input and select box to updated
Hey guys I'm building my first website and I cannot figure how to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.