-->
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.  [ 10 posts ] 
Author Message
 Post subject: NHibernate.MappingException: No persisters for
PostPosted: Thu Jun 16, 2005 10:34 am 
Newbie

Joined: Thu Jun 16, 2005 10:20 am
Posts: 6
Im getting this error:

NHibernate.MappingException: No persisters for:

I checked for typo's and all have hbm.xml file as Embedded Resource. For some reason, it is giving me this error. I have fixed the same problem before but couldn't this time. ID column is identity column which is the primary key. Here is my hbm.xml and my class file:

Code:
<?xml version="1.0" encoding="utf-8" ?>
      <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
         <class name="SEI.FLW.Fees.DataAccessTier.DurationOfAccount, SEI.FLW.Fees.DataAccessTier" table="DurationOfAccount">
            <id name="iID" column="ID" type="Int32" unsaved-value="0">
               <generator class="native" />
            </id>
            <property name="iAccountID" column="AccountID" type="String" />
            <property name="iMasterID" column="MasterID" type="String" />
            <property name="iDateAccountCameIn" column="DateAccountCameIn" type="DateTime" />
            <property name="iDateAccountWentOut" column="DateAccountWentOut" type="DateTime" />
            
         </class>
      </hibernate-mapping>



The class file is:

Code:
/*
   Insert License speil here!!!!
*/
using System;
using System.Collections;

namespace SEI.FLW.Fees.DataAccessTier
{
   #region Class DurationOfAccount
   /// <summary>
   ///   
   /// </summary>
   [Serializable]
   public sealed class DurationOfAccount
   {
      #region Private Members
      private bool misChanged;
      private bool misDeleted;
      private int mID;
      private string mAccountID;
      private string mMasterID;
      private DateTime mDateAccountCameIn;
      private DateTime mDateAccountWentOut;      
      #endregion // End of Private Members
      
      #region Default ( Empty ) Class Constuctor
      public DurationOfAccount()
      {
         misChanged = false;
         misDeleted = false;
         mID = 0;
         mAccountID = String.Empty;
         mMasterID = String.Empty;
         mDateAccountCameIn = DateTime.MinValue;
         mDateAccountWentOut = DateTime.MinValue;
      }
      #endregion // End of Default ( Empty ) Class Constuctor
      
      #region Public Accessors
      #region ID
      /// <summary>
      ///
      /// </summary>      
      public int ID
      {
         get { return mID; }
         set { misChanged |= (mID != value); mID = value; }
      }
      #endregion // End of ID
         
      #region AccountID
      /// <summary>
      ///
      /// </summary>      
      public string AccountID
      {
         get { return mAccountID; }
         set   
         {
            if( value.Length > 12)
               throw new ArgumentOutOfRangeException("Invalid value for AccountID", value, value.ToString());
            
            misChanged |= (mAccountID != value); mAccountID = value;
         }
      }
      #endregion // End of AccountID
         
      #region MasterID
      /// <summary>
      ///
      /// </summary>      
      public string MasterID
      {
         get { return mMasterID; }
         set   
         {
            if( value.Length > 5)
               throw new ArgumentOutOfRangeException("Invalid value for MasterID", value, value.ToString());
            
            misChanged |= (mMasterID != value); mMasterID = value;
         }
      }
      #endregion // End of MasterID
         
      #region DateAccountCameIn
      /// <summary>
      ///
      /// </summary>      
      public DateTime DateAccountCameIn
      {
         get { return mDateAccountCameIn; }
         set { misChanged |= (mDateAccountCameIn != value); mDateAccountCameIn = value; }
      }
      #endregion // End of DateAccountCameIn
         
      #region DateAccountWentOut
      /// <summary>
      ///
      /// </summary>      
      public DateTime DateAccountWentOut
      {
         get { return mDateAccountWentOut; }
         set { misChanged |= (mDateAccountWentOut != value); mDateAccountWentOut = value; }
      }
      #endregion // End of DateAccountWentOut
         
      #region IsChanged
      /// <summary>
      /// Returns whether or not the object has changed it's values.
      /// </summary>
      public bool IsChanged
      {
         get { return misChanged; }
      }
      #endregion // End of HasChanged
      
      #region IsDeleted
      /// <summary>
      /// Returns whether or not the object has changed it's values.
      /// </summary>
      public bool IsDeleted
      {
         get { return misDeleted; }
      }
      #endregion // End of IsDeleted
      #endregion // End of Public Accessors
      
      #region Internal Accessors for NHibernate
      #region iID
      /// <summary>
      ///
      /// </summary>
      internal int iID
      {
         get { return mID; }
         set { mID = value; }
      }
      #endregion
      #region iAccountID
      /// <summary>
      ///
      /// </summary>
      internal string iAccountID
      {
         get { return mAccountID; }
         set { mAccountID = value; }
      }
      #endregion
      #region iMasterID
      /// <summary>
      ///
      /// </summary>
      internal string iMasterID
      {
         get { return mMasterID; }
         set { mMasterID = value; }
      }
      #endregion
      #region iDateAccountCameIn
      /// <summary>
      ///
      /// </summary>
      internal DateTime iDateAccountCameIn
      {
         get { return mDateAccountCameIn; }
         set { mDateAccountCameIn = value; }
      }
      #endregion
      #region iDateAccountWentOut
      /// <summary>
      ///
      /// </summary>
      internal DateTime iDateAccountWentOut
      {
         get { return mDateAccountWentOut; }
         set { mDateAccountWentOut = value; }
      }
      #endregion
      #endregion // Internal Accessors for NHibernate
      
      
      #region Public Functions
      #region MarkAsDeleted
      public void MarkAsDeleted()
      {
         misDeleted = true;
         misChanged = true;
      }
      #endregion
      #endregion
      
   }
   #endregion // Class DurationOfAccount
}


Top
 Profile  
 
 Post subject: some more info....
PostPosted: Thu Jun 16, 2005 1:06 pm 
Newbie

Joined: Thu Jun 16, 2005 10:20 am
Posts: 6
Below is the get method I'm using:


public DurationOfAccount getDurationOfAccount(int ID)
{
ISession session = null;
DurationOfAccount objDurationOfAccount = null;
try
{
session = factory.OpenSession();
objDurationOfAccount = (DurationOfAccount)session.Load(typeof(DurationOfAccount), ID);
}
catch(ArgumentOutOfRangeException)
{
return null;
}
catch(Exception ex)
{
throw ex;
}
finally
{
session.Close();

}
return objDurationOfAccount;
}

Thanks
Rajesh Meenrajan
http://meenrajan.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 1:26 am 
Newbie

Joined: Wed May 11, 2005 9:34 pm
Posts: 9
In your config file you say
<id name="iID" column="ID" type="Int32" unsaved-value="0">

But in your class file there is no property named "iID", therefore NHibernate cannot find the persister. You have a field named iID though, but by default NHibernate accesses properties. You have a property with the name "ID", so try and change the line in the config file to

<id name="ID" column="ID" type="Int32" unsaved-value="0">

This goes for the other properties you have defined in your config file also.


Regards,
Lars Arne Brekken


Top
 Profile  
 
 Post subject: nope I'm using the internal accessors
PostPosted: Fri Jun 17, 2005 12:50 pm 
Newbie

Joined: Thu Jun 16, 2005 10:20 am
Posts: 6
I'm using the internal accessors as iID,iAccountID etc.This has been working for other classes. Somewhere NHibernate code is screwing up. I have posted this 2 one of the developer. still no resolution yet.

Thanks for ur effort.

Rajesh Meenrajan
http://meenrajan.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 18, 2005 11:43 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Can you post the log.txt ? (enable DEBUG in your app.config before)

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 11:27 am 
Newbie

Joined: Thu Jun 16, 2005 10:20 am
Posts: 6
I dont know how to enable debugging mode for nhibernate. I use log4net to log the exception messages. I know NHibernate internally uses log4net to log messages. This is the only info I got logged:

Logger Message
---------- -----------------------
NHibernate.Impl.SessionImpl loading [DurationOfAccount#2]


Thanks
Rajesh
http://meenrajan.blogspot.com


Top
 Profile  
 
 Post subject: Your field name is mID
PostPosted: Mon Jun 20, 2005 11:58 am 
Newbie

Joined: Mon Jun 20, 2005 10:22 am
Posts: 2
I noticed that your ID Field is 'mID' and your mapping specified iID. That could be your problem.

Also, when I am using fields for NHibernate I always include a mapping hint in the hbm file:

<id name="ID" access="field.lowercase-underscore"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 21, 2005 4:01 pm 
Newbie

Joined: Thu Jun 16, 2005 10:20 am
Posts: 6
I'm using internal accessors.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 8:15 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
sivatx wrote:
I dont know how to enable debugging mode for nhibernate. I use log4net to log the exception messages. I know NHibernate internally uses log4net to log messages. This is the only info I got logged:

Logger Message
---------- -----------------------
NHibernate.Impl.SessionImpl loading [DurationOfAccount#2]


To enable debug log, you have to edit your app.config (where log4net is configured) and set the level to "DEBUG"...

For your problem, make sure that your hbm.xml file is loaded by NHibernate (read the debug log)

For more information about enabling debug log, read this post

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 11:22 am 
Newbie

Joined: Thu Jun 16, 2005 10:20 am
Posts: 6
The session was loaded correctly. It was my bad :oops: . I forgot to add my class to the configuration. That was the root cause of the messy problem.

Thanks NHibernate Team for your time! :)


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