We are new to Nhiberanate concept, We had downloaded the NHibernate sample form CodeProject site using
http://www.codeproject.com/KB/architect ... tices.aspx. We had executed this sample it is working fine, but when we are tring to add our form in an application it doesn't not display any record. Following is our code.
Table signature
CREATE TABLE [dbo].[TBL_EMPLOYEE](
[EMP_CODE] [int] IDENTITY(1,1) NOT NULL,
[EMP_NAME] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[EMP_DEPTNAME] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[EMP_EMAILID] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[EMP_PASSWORD] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_TBL_EMPLOYEE_1] PRIMARY KEY CLUSTERED
(
[EMP_CODE] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
hbm.xml file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BasicSample.Core.Domain.Employee,BasicSample.Core" table="TBL_EMPLOYEE" lazy="false">
<id name="EMP_CODE" column="EMP_CODE" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="EMP_NAME" column="EMP_NAME" type="String"/>
<property name="EMP_DEPTNAME" column="EMP_DEPTNAME" type="String"/>
<property name="EMP_EMAILID" column="EMP_EMAILID" type="String"/>
<property name="EMP_PASSWORD" column="EMP_PASSWORD" type="String"/>
</class>
</hibernate-mapping>
.class file
using System;
using System.Collections.Generic;
using BasicSample.Core.Utils;
namespace BasicSample.Core.Domain
{
public class Employee:DomainObject<string>
{
private Employee()
{ }
public Employee(string EmpName)
{
EMP_NAME = EmpName;
}
//private variable
// private int _Code="";
private string _Name = "";
private string _DeptName = "";
private string _EmailId = "";
private string _Password = "";
//public string EMP_CODE
//{
// get { return _Code; }
// set { _Code = value; }
//}
public string EMP_NAME
{
get { return _Name; }
set { _Name = value; }
}
public string EMP_DEPTNAME
{
get { return _DeptName; }
set { _DeptName = value; }
}
public string EMP_EMAILID
{
get { return _EmailId; }
set { _EmailId = value; }
}
public string EMP_PASSWORD
{
get { return _Password; }
set { _Password = value; }
}
public override int GetHashCode()
{
return (GetType().FullName + "|" + EMP_NAME + "|" + EMP_DEPTNAME).GetHashCode();
//throw new Exception("The method or operation is not implemented.");
}
}
}
above are the files we were using but after broswing the page it show nothing. Where is the problem we are not able to identify?
poonam