-->
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.  [ 6 posts ] 
Author Message
 Post subject: No persister for error when running test.
PostPosted: Sun Apr 05, 2009 10:48 pm 
Newbie

Joined: Sun Apr 05, 2009 8:04 am
Posts: 3
Hi,

I am writing an app using FluentNHibernate.

To start with I am trying to run a test where I insert a row into my db table.

My entities are in a seperate project (OurRecipes.Domain) and my mappings ie ClassMap<entity> classes are in a folder in this project.

In my test project I have the configuration of NHibernate in the App.Config.

So when I run the test the error occurs on this line session.Load below.
Error is

No persister for: OurRecipes.Domain.Recipe


Code:
         using (var session = factory.OpenSession())
            {
                Recipe recipe = session.Load<Recipe>(1);

            }



This is how how I am creating my ISessionFactory

Code:
namespace OurRecipes
{
    public class SessionFactoryCreator
    {
        public static ISessionFactory Create()
        {
            Configuration cfg = new Configuration()
                .AddAssembly(typeof(SessionFactoryCreator).Assembly)
                .AddAssembly(typeof(Recipe).Assembly);
               
            return cfg.BuildSessionFactory();
        }
    }
}


It seems to me that this code is doing nothing and not loading the mappings at all. Recipe is in my entity project with the mappings and SessionFactoryCreator is in my tes project with App.Config.

Any ideas why I get this error please?

Malcolm


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 2:39 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Can you post you configuration ? Enable debug logging and check the output.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 2:43 am 
Newbie

Joined: Sun Apr 05, 2009 8:04 am
Posts: 3
This the config.. i will try enable debug logging as well


Code:
  <configSections>
    <section
        name="hibernate-configuration"
        type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
        />
  </configSections>

  <!-- Add this element -->
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.connection_string">
        Server=(local);initial catalog=OurRecipesDB;Integrated Security=SSPI
      </property>
      <mapping assembly="OurRecipes.Domain" />
    </session-factory>
  </hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 3:26 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Hmm, looks good. Are your mapping files set to "Embedded Resource" ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 3:29 am 
Newbie

Joined: Sun Jul 06, 2008 8:55 am
Posts: 3
I am using FluentNHibernate.

This means there are classes that derive from ClassMap<T> where you enter the mappings.

Are you familiar with this???

So there are only .cs files.

Malcolm


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 3:48 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Ah, sorry. Dumb question. But then you better ask the question in the fluent mailing list. I think there's one at google groups.

_________________
--Wolfgang


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