Solved

Exception mapping file using NHIBERNATE

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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