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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:57:49+00:00 2026-06-15T21:57:49+00:00

I’m using a mapping with a filter. But when I try to persist my

  • 0

I’m using a mapping with a filter.

But when I try to persist my object, it first wants to get a snapshot (because my Id is a string).

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="DomainLayer.General" assembly="DomainLayer">
  <class name="Fund" table="OPENA_BriefW" lazy="false">
    <id name="Id" column="`BRWNUMMER`" type="string" >
    </id>

    <property name="Name" column="`BRWNAAM`" type="string"  />
    <property name="Contact" column="`BRWNAAM2`" type="string"  />
    <property name="Address" column="`BRWADRES`" type="string"  />
    <property name="City" column="`BRWSTAD`" type="string"  />
    <property name="Zip" column="`BRWPOST`" type="string" />
    <property name="Phone" column="`BRWTELEFOON`" type="string" />
    <property name="Fax" column="`BRWTELEFAX`" type="string" />
    <property name="Iban" column="`brw_iban`" type="string" />
    <property name="BankAccount" column="`BRWBANKNU`" type="string" />
    <property name="Swift" column="`brw_swift`" type="string" />
    <property name="ReceiveOffice" column="`BRWONTVKANT`" type="int" />
    <property name="RegionDirection" column="`BRWGEWESTDIR`" type="int" />

    <many-to-one name="Country" class="DomainLayer.General.CodeDescription" fetch="join" not-found="ignore">
      <formula>'ALG'</formula>
      <formula>'0'</formula>
      <formula>'WG030'</formula>
      <column name="`BRWLAND`" />
      <formula>:LanguageFilter.Id</formula>
    </many-to-one>

  </class>
</hibernate-mapping>

As you can see the filter :LanguageFilter.Id is the one causing the troubles. When I do a normal .List() it doesn’t cause problems.

But when I persist, it first wants to check if the Fund already exists yes/no. By doing a .Get (with the Id).

Then I get the error can’t retrieve snapshot because in my query he doesn’t replace :LangaugeFilter.Id with the effective value i set on my session.

I enable the filter on my session like so:

session.EnableFilter("LanguageFilter").SetParameter("Id", 1);

Here’s the filter-def mapping:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <filter-def name='LanguageFilter' >
    <filter-param name='Id' type='System.Int32' />
  </filter-def>
</hibernate-mapping>

This post (comment 4) http://ayende.com/blog/3993/nhibernate-filters says that session.Get and Load ignores filters.

Are there any alternatives, because I need that language to be variable.

  • 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-06-15T21:57:50+00:00Added an answer on June 15, 2026 at 9:57 pm

    Ok, what I did was the following: I didn’t use SaveOrPersist, but Save when new and Persist when I had an old one. This didn’t execute the extra get.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
i got an object with contents of html markup in it, for example: string
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.