-->
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: No persister for (mapping exception error)
PostPosted: Tue Jun 01, 2010 3:53 pm 
Newbie

Joined: Tue Jun 01, 2010 3:37 pm
Posts: 3
Hi all, I am new to using nHibernate and have come across this issue when I try saving my object. This is a WEB project and apparently many of the solutions suggest to embed the XML file as a resource. Don't think I can do that with a web project... here is my code:

Code:
namespace Timesheet.BusinessObjects
{
    /// <summary>
    /// Creates an instance of Customer.
    /// </summary>
    public class Customer : PersistentManager
    {
        // Properties
        public DateTime DateModified { get; private set; }
        public String CustomerName { get; private set; }
        public Int64 CustomerID { get; private set; }
        public Int64 ProjectID { get; private set; }

        // Constructor
        public Customer()
        {           
        }

        // Methods
        public static Customer CreateCustomer(string customerName)
        {
            Customer customer = new Customer();
            customer.CustomerName = customerName;
            customer.DateModified = DateTime.Now;
            customer.ProjectID = 0;
            customer.Save(); //Error here
            return customer;
        }
    }
}


Here is my mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
  <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
    <class name="Timesheet.BusinessObjects.Customer" table="Customers" lazy="false">
      <id name="CustomerID">
        <column name="CustomerID" />
        <generator class="native" />
      </id>
      <property name="DateModified"></property>
      <property name="CustomerName"></property>
      <property name="CustomerID"></property>
      <property name="ProjectID"></property>
    </class>   
  </hibernate-mapping>


Thanks all in advance.


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.