You need to add the mappings too. cfg.AddAssembly(....)
2016-09-01 16:57 GMT+02:00 Steve Lyle <[email protected]>: > Can you tell me WHAT is not mapped? > How do you map it? > > this is the error: > Server Error in '/' Application. > ------------------------------ > *vDoors is not mapped [from vDoors]**Description: *An unhandled exception > occurred during the execution of the current web request. Please review the > stack trace for more information about the error and where it originated in > the code. > > *Exception Details: *NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: > vDoors is not mapped [from vDoors] > > *Source Error:* > > [QuerySyntaxException: Tko.SmartMoves.Modules.Operations.Data.vDoors is not > mapped [from vDoors]] > > NHibernate.Hql.Ast.ANTLR.SessionFactoryHelperExtensions.RequireClassPersister(String > name) in > c:\...\nhibernate-core-master\src\NHibernate\Hql\Ast\ANTLR\SessionFactoryHelperExtensions.cs:228 > NHibernate.Hql.Ast.ANTLR.Tree.FromElementFactory.AddFromElement() in > c:\...\nhibernate-core-master\src\NHibernate\Hql\Ast\ANTLR\Tree\FromElementFactory.cs:82 > > > > > > This is the code (all 4 *qry*'s yield the same result): > var cfg = new Configuration(); > cfg.Configure(); // CONFIG FILE IS IN THE WEB SITE'S BIN > FOLDER > ISessionFactory sesFactory = cfg.BuildSessionFactory(); > var ses = sesFactory.OpenSession(); > // FAILS > //var qry = ses.CreateQuery("select ParentZoneRecid, > ParentZone, ParentZoneEnabled, Zone, ZoneStatus, ZoneEnabled, GenericRecid, > GenericEntity, GenericName, GenericEnabled, GenericType from vDoors"); > //var qry = ses.CreateQuery("select ParentZoneRecid, > ParentZone, ParentZoneEnabled, Zone, ZoneStatus, ZoneEnabled, GenericRecid, > GenericEntity, GenericName, GenericEnabled, GenericType from > Tko.SmartMoves.Modules.Operations.Data.vDoors"); > //var qry = ses.CreateQuery("select r from > Tko.SmartMoves.Modules.Operations.Data.vDoors r"); > var qry = ses.CreateQuery("from vDoors"); > IList<vDoors> x = qry.List<vDoors>(); > > > > Here is my mapping file (set as embedded resource): > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false" > assembly="Operations" namespace="Tko.SmartMoves.Modules.Operations.Domain" > default-lazy="false"> > <class name ="vDoors" table="dbo.vDoors" dynamic-update="false" > lazy="false"> > <cache usage="read-only"/> > <id name="DoorId" column="DoorId" type="Int64"> > <generator class="native" /> > </id> > <property name="ParentZoneRecid" /> > <property name="ParentZone" /> > <property name="ParentZoneEnabled" /> > <property name="Zone" /> > <property name="ZoneStatus" /> > <property name="ZoneEnabled" /> > <property name="GenericRecid" /> > <property name="GenericEntity" /> > <property name="GenericName" /> > <property name="GenericEnabled" /> > <property name="GenericType" /> > </class> > </hibernate-mapping> > > > > This is my class: > namespace Tko.SmartMoves.Modules.Operations.Domain > { > > // either way same "not mapped" errro public class vDoors : > DomainObject<long> > public class vDoors > { > public virtual Int64 ParentZoneRecid { get; set; } > public virtual string ParentZone { get; set; } > public virtual bool ParentZoneEnabled { get; set; } > public virtual Int64 DoorId { get; set; } > public virtual string Zone { get; set; } > public virtual string ZoneStatus { get; set; } > public virtual bool ZoneEnabled { get; set; } > public virtual Int64 GenericRecid { get; set; } > public virtual string GenericEntity { get; set; } > public virtual string GenericName { get; set; } > public virtual bool GenericEnabled { get; set; } > public virtual string GenericType { get; set; } > > public override int GetHashCode() > { > return (GetType().FullName + "|" + DoorId.ToString()). > GetHashCode(); > } > } > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
