Solved

Exception mapping file using NHIBERNATE

Posted on 2009-05-20
1
554 Views
Last Modified: 2012-05-07
I am trying to create a sample NHibernate application. And I am getting an exception {"Could not find a getter for property 'Id' in class 'NHibernateTest.Users'"} . The Id is the primary key for the table.

I have tried to set the Id as

 public int ID
        {
            get { return this.Id;}
        }
based on some help from the internet.
But still this doesnt help. I have attached all the files.

Hope someone can help me out.

Please rename all the files without the .txt extension.





AssemblyInfo.cs.txt
Program.cs.txt
Users.cs.txt
Users.hbm.xml.txt
0
Comment
Question by:pawan2290
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
zwei earned 500 total points
ID: 24440169
Could not find a getter for property 'Id' in class 'NHibernateTest.Users

This means it is trying to find 'Id', when it should be looking for 'ID'. I'm not experienced with hibernate but I can see in your xml you have written 'Id' and not 'ID'.

You can either change the property to match the call, or change the call.

Example:
private int id;
 
public int Id
{
    get { return this.id;}
}

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question