0

In my asp.net mvc application I'm using nhibernate 3.2 as ORM. I have catalogue structure like ..\Models\Persons with User.cs and OtherClass.cs in it and also ..\Mapping with files hibernate.xml,Persons.xml I added mapping files as embeeded resources and in code of application I have

Assembly assembly = Assembly.GetExecutingAssembly();
config.AddAssembly(assembly);
sFactory = config.BuildSessionFactory();

I tried to run simple hql query

From User up WHERE up.Password=admin AND up.Login=admin

but I still get an error:

A first chance exception of type 'NHibernate.Hql.Ast.ANTLR.QuerySyntaxException' occurred in NHibernate.DLL
User is not mapped [ FROM User up WHERE up.Password=admin AND up.Login=admin]

I can't get an idea what I'm doing wrong. I'd appreciate any help.

Dan J
  • 16,319
  • 7
  • 50
  • 82
Axxxon
  • 703
  • 2
  • 11
  • 27

1 Answers1

0

Can you check if the mappings are loaded by inspecting the sessionfactory properties after creation?

Hace
  • 1,421
  • 12
  • 17
  • when try to check class with sessionfactory.GetClassMetadata() i get null everytime i check any class, seems embedding fails for it...but how to repair it? – Axxxon Dec 28 '11 at 21:04
  • ok found out with `config.AddInputStream()`, now everything works :) – Axxxon Dec 28 '11 at 21:48