-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem With Sample Code
PostPosted: Tue Aug 26, 2008 1:19 am 
Newbie

Joined: Mon Aug 18, 2008 7:02 am
Posts: 6
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.