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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:40:31+00:00 2026-06-14T09:40:31+00:00

I have a class with a field: protected DateTime insertDate; This is mapping for

  • 0

I have a class with a field:

    protected DateTime insertDate;

This is mapping for this fiels:

    <property name="InsertDate" access="field.camelcase" update="false" />

This field is set when with ctor

    public DocuBase(DateTime insertDate)

and is persisted only when row is added to the database. I don’t need property for it at all, no setter & no getter. I worked in NHibernate 3.

And now, I’ve moved from NHiberbate 3 to NHibernate 3.3.1, and I get this exception when session factory is created:

Could not find the property ‘InsertDate’, associated to the field
‘insertDate’, in class ‘XXXX’

Why is is happening & how can I change mapping in order to get rid of the exception?

EDIT: Below answer is completly correct. But for those of you that don’t need/don’t want to have a property, and only field, there’s another solution:

  • set name attribute to field name (in my case it is insertDate) and remember to have correct column name

    <property name="insertDate" column="InsertDate" access="field.camelcase" update="false" />
    
  • 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-14T09:40:32+00:00Added an answer on June 14, 2026 at 9:40 am

    It is case sensitivity, this will work.

    <property name="insertDate" column="InsertDate" update="false" />
    

    Looks like in release 3.1.0, there was a breaking change

    NH today accepts code below. It would be better if this would throw – it causes problem when configurate NH (or 3rd party tools) other ways than by hbm, using the property name (or memberinfo) of the public interface.

    [hbm]
    <property name="Name" access="field.camelcase" />
    
    [code]
    string name;
    public virtual string SomeThingCompletelyDifferent{
                                      get {return name;}
                                      set{name=value;}
    }
    

    Note: This will be a breaking change.

    ps – updated answer to remove reference to use Property with private set as this was not what was being looked for and above breaking change is more relevant.

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

Sidebar

Related Questions

I have a code using protected field in super class. How can I avoid
I have a class that contains a boolean field like this one: public class
I have a model with a datetime field: class MyModel(models.Model): created = models.DateTimeField(auto_now =
I have three models: class User include Mongoid::Document field :name, :type => String has_many
I have a class that defines a protected field. The protected field has a
I want to give access to protected properties to another class. I have been
I have this class declaration abstract class A { protected static String message =
I have this class class Validator implements iValidation{ protected $_fields, $_errors; public function __construct($fields){
I have a class like this: public class LocalizedDataAnnotationsModelMetadataProvider : DataAnnotationsModelMetadataProvider { protected override
I have a class Field of which there are two sub-classes AccountField and DecimalField

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.