-->
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: NHibernate.MappingException: No persister for...
PostPosted: Mon Feb 01, 2010 9:16 am 
Newbie

Joined: Mon Feb 01, 2010 9:12 am
Posts: 2
i'm having a mapping exception. it seems as though it cannot find a persister for a class.
plz, any help would be greatly appreciated
i have the following config for hibernate

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="moe">
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Data Source=MISU-SA\DBSERV;Database=MOE;User ID=;Password=r;</property>
<property name="connection.isolation">ReadCommitted</property>
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="show_sql">true</property>
<!-- HBM Mapping Files -->
<mapping assembly="MOE.Core" />
</session-factory>
</hibernate-configuration>

here is the class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MOE.Core.VO;

namespace MOE.Core.Domain
{
public class News : DomainObject<int>
{
private int id;
private string title;
private string body;
private DateTime date;
private string tags;
private string teaser;

public News()
{

}

public News(int pId, string pTitle, string pBody, DateTime pDate, string pTags, string pTeaser)
{
this.id = pId;
this.title = pTitle;
this.body = pBody;
this.date = pDate;
this.tags = pTags;
this.teaser = pTeaser;
}

public News(NewsVO newsVO)
{
this.id = newsVO.Id;
this.title = newsVO.Title;
this.body = newsVO.Body;
this.date = newsVO.Date;
this.tags = newsVO.Tags;
this.teaser = newsVO.Teaser;
}

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

public string Title
{
get { return title; }
set { title = value; }
}

public string Body
{
get { return body; }
set { body = value; }
}

public string Tags
{
get { return tags; }
set { tags = value; }
}

public string Teaser
{
get { return teaser; }
set { teaser = value; }
}

public DateTime Date
{
get { return date; }
set { date = value; }
}

public override int GetHashCode()
{
return (GetType().FullName + "|" +
tags + "|" +
teaser).GetHashCode();
}

}
}


here is the mapping to the class

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="MOE.Core" assembly="MOE.Core">
<class name="MOE.Core.Domain.News, MOE.Core.Domain" table="news" lazy="false">
<id name="id" column="id">
<generator class="identity" />
</id>

<property name="title" column="title" />
<property name="news" column="news" />
<property name="date" column="date" />
<property name="tags" column="tags" />
<property name="teaser" column="teaser" />

</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Re: NHibernate.MappingException: No persister for...
PostPosted: Tue Feb 02, 2010 6:58 am 
Newbie

Joined: Mon Aug 31, 2009 6:30 am
Posts: 9
Location: Bolzano, Italy
Hi,

Can you check whether the Build Action for your .hbm.xml mapping file is set to "Embedded Resource"? (can be found in the properties view of your mapping file). If not, please choose Embedded Resource. This seems to be the typical error message when the Build Action is set to something else.

Best regards,
Martin
http://angler.wordpress.com (blog about c#, nhibernate, Pex, Code Contracts, etc.)

_________________
Tutorials and solved problems under:
http://angler.wordpress.com


Top
 Profile  
 
 Post subject: Re: NHibernate.MappingException: No persister for...
PostPosted: Tue Feb 02, 2010 9:45 am 
Newbie

Joined: Mon Feb 01, 2010 9:12 am
Posts: 2
The mapping file is set as an embedded resource.


Top
 Profile  
 
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.