When I added the assembly programmatically *cfg.AddAssembly("Operations");* 
 This line of code throws the following.
I take this to mean hibernate.cfg.xml was already including the assembly.


----
Does it help to know that vRSMgrsScreenGrig & vDoors are both in the same 
name space?
- RSMgrs has a Dao and a IDoa interface.
- But I hadn't built a separate Doa and interface for vDoors.
Could this be a problem?
----




Server Error in '/' Application.
------------------------------
*Duplicate class/entity mapping 
Tko.SmartMoves.Modules.Operations.Domain.vRSMgrsScreenGrid**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.DuplicateMappingException: Duplicate 
class/entity mapping 
Tko.SmartMoves.Modules.Operations.Domain.vRSMgrsScreenGrid

*Source Error:* 

Line 71: 
Line 72:             /* does NOT work (using HQL) ~ throws a "vDoors not 
mapped" error */Line 73:             cfg.AddAssembly("Operations");Line 74:     
        var ses = sesFactory.OpenSession();
Line 75:             // FAILS 






On Thursday, September 1, 2016 at 12:49:56 PM UTC-4, Steve Lyle wrote:
>
> I don't think I showed it in my original post but didn't I do that with 
> the following from hibernate.cfg.xml?
> Also other queries in this namespace are working without issue.
>
> But I will still try what you say.
>
> from hibernate.cfg.xml:
> <?xml version="1.0" encoding="utf-8"?>
> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
>   <session-factory>
> ....
>     <mapping assembly="Operations" />
> ....
>   </session-factory>
> </hibernate-configuration>
>
>
>
>
>
> On Thursday, September 1, 2016 at 12:06:22 PM UTC-4, Gunnar Liljas wrote:
>>
>> 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.

Reply via email to