-->
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.  [ 3 posts ] 
Author Message
 Post subject: Error: No persisters for NhibTest.User
PostPosted: Mon Aug 15, 2005 1:46 am 
help please

My code:


nhConfig = new Configuration();
nhConfig.AddAssembly("NhibTest");
nhFactory = nhConfig.BuildSessionFactory();

ISession session = nhFactory.OpenSession();

ITransaction transaction = session.BeginTransaction();

User newUser = new User();
newUser.Id = "joe_cool";
newUser.UserName = "Joseph Cool";
newUser.Password = "abc123";
newUser.EmailAddress = "joe@cool.com";
newUser.LastLogon = DateTime.Now;

// Tell NHibernate that this object should be saved
session.Save(newUser);

// commit all of the changes to the DB and close the ISession
transaction.Commit();
session.Close();


It looks like if Nhibernate don't see the User.hmb.xml..
May be I must link this file?

my User.hmb.xml is:

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

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">

<class name="NhibTest.User, NhibTest" table="Users">
<id name="Id" column="LogonId" type="String" length="20">
<generator class="assigned" />
</id>

<property name="UserName" column="Name" type="String" length="40"/>
<property name="Password" type="String" length="20"/>
<property name="EmailAddress" type="String" length="40"/>
<property name="LastLogon" type="DateTime"/>
</class>

</hibernate-mapping>


Top
  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 12:45 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
This is a classic newbie problem:

Make sure that the file "User.hbm.xml" is embedded in your assembly and that you didn't make any typo error.

Read the file "log.txt" after enabling DEBUG in log4net configuration, you should see how NHibernate is loading your User class mapping...

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Last edited by KPixel on Tue Aug 16, 2005 9:36 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 1:15 pm 
User.hmb.xml should be User.hbm.xml


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.