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 599799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:32:14+00:00 2026-05-13T16:32:14+00:00

Hey Guys I would very much appreciate some help with the following. We’re using

  • 0

Hey Guys I would very much appreciate some help with the following. We’re using fluent to control the mappings for nhibernate and its all gone well so far. We’ve basically got a scheduled based CMS system and I’m having problems using the HasMany mapping to exclude the non-live child categories.

So we have the following Data Tables, simplified slightly which map to sensible BO’s.

[Category]
Id
Name
Parent_Id
Schedule_Id

[Schedule]
Id
IsPaused (Bit 0/1)
StartDate
StopDate

The CategoryMap looks a bit like this (vb.net sorry!).

Public Sub New()
    Id(Function(x) x.Id)
    Map(Function(x) x.Name)
    HasMany(Function(x) x.Children).Inverse().KeyColumn("Parent_id").Cascade.All()
    References(Function(x) x.Parent)
    References(Function(x) x.Schedule).ForeignKey("Schedule_id").Fetch.Join().Nullable()
End Sub

What I would like to do is add a filter on the HasMany mapping, but can’t seem to get Where to work as I need to.

Could someone please point me in the right direction?

Many Thanks,

Mike.

  • 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-13T16:32:15+00:00Added an answer on May 13, 2026 at 4:32 pm

    You don’t show the child class so I’m not sure what the filter might be. Assuming you want to filter on an IsActive bit column the mapping would be:

    Public Sub New()
        Id(Function(x) x.Id)
        Map(Function(x) x.Name)
        HasMany(Function(x) x.Children).Inverse().KeyColumn("Parent_id").Cascade.All()
            .Where("IsActive = 1")
        References(Function(x) x.Parent)
        References(Function(x) x.Schedule).ForeignKey("Schedule_id").Fetch.Join().Nullable()
    End Sub
    

    The key point is that the Where clause contains a snippet of SQL not HQL, so you have to use database field names instead of property names.

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

Sidebar

Related Questions

Hey guys, I have some questions would like to ask: I wanna ask how
Hey guys, i was wondering if you would help me a little with my
Hey guys, I have some code that I found that I would rather use
Hey there guys and gals. I'm very new to php and am following various
Hey guys. I have an app in Objective C (using xcode) that I would
Hey guys I would like to save some time....is there a form generator that
Hey guys, so I would like you to help with an issue that I'm
Hey guys I'm tired and can't figure this one out so any help would
Hey guys, I have developed a small site that i would like to embed
Hey guys this should be simple, I'm just not seeing it, I would like

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.