-->
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.  [ 4 posts ] 
Author Message
 Post subject: Unknown entity class: NHibernate.Examples.QuickStart.User
PostPosted: Fri Jul 13, 2007 12:56 am 
Newbie

Joined: Fri Jul 13, 2007 12:48 am
Posts: 2
It is users.sql :

use NHibernate
go

CREATE TABLE users (
LogonID nvarchar(20) NOT NULL default '0',
Name nvarchar(40) default NULL,
Password nvarchar(20) default NULL,
EmailAddress nvarchar(40) default NULL,
LastLogon datetime default NULL,
PRIMARY KEY (LogonID)
)
go


It is users.cs :

using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Cfg;


namespace NHibernate.Examples.QuickStart
{
public class User
{
private string id;
private string userName;
private string password;

private string emailAddress;
private DateTime lastLogon;


public User()
{
}

public string Id
{
get { return id; }
set { id = value; }
}

public string UserName
{
get { return userName; }
set { userName = value; }
}

public string Password
{
get { return password; }
set { password = value; }
}

public string EmailAddress
{
get { return emailAddress; }
set { emailAddress = value; }
}

public DateTime LastLogon
{
get { return lastLogon; }
set { lastLogon = value; }
}

}

//interface ISession
//{
// void save(users newUser);

// void Save(users newUser);
//}

}


It is User.hbm.xml :

using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Cfg;


namespace NHibernate.Examples.QuickStart
{
public class User
{
private string id;
private string userName;
private string password;

private string emailAddress;
private DateTime lastLogon;


public User()
{
}

public string Id
{
get { return id; }
set { id = value; }
}

public string UserName
{
get { return userName; }
set { userName = value; }
}

public string Password
{
get { return password; }
set { password = value; }
}

public string EmailAddress
{
get { return emailAddress; }
set { emailAddress = value; }
}

public DateTime LastLogon
{
get { return lastLogon; }
set { lastLogon = value; }
}

}

//interface ISession
//{
// void save(users newUser);

// void Save(users newUser);
//}

}

It is App.config :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.connection.connection_string" value="Data Source=dev2;Initial Catalog=NHibernate;User ID=sa;Password=buyagift;" />
</nhibernate>

</configuration>


It is Programs.cs :

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace NHibernate
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Application.Run(new NHibernate.Form1());
Application.Run(new NHibernate.Examples.QuickStart.Form1());

}
}
}



This code generates following error:

Unknown entity class: NHibernate.Examples.QuickStart.User

Can anyone help me please?
Thanks
[/code][/b]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 13, 2007 3:24 am 
Regular
Regular

Joined: Mon Aug 29, 2005 3:07 pm
Posts: 77
have you set the build action of your hbm.xml file to 'embedded resource' ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 13, 2007 5:01 am 
Regular
Regular

Joined: Wed Apr 25, 2007 4:18 am
Posts: 51
Location: Belarus, Gomel
Hi itbrainsoft!

BTW you don't show your mapping file - you post class code twice.

_________________
WBR, Igor


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 2:42 am 
Newbie

Joined: Fri Jul 13, 2007 12:48 am
Posts: 2
yea


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

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.