Solved

Exception mapping file using NHIBERNATE

Posted on 2009-05-20
1
544 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
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now