All, I'm getting a weird problem - I'm doing the following call:
ILocation loc = Session.Get<Location>(id); and NH is throwing this error: Exception Unable to cast object of type 'INHibernateProxyProxy2183142372c34751a1aceee41a501ee3' to type 'Intellident.Core.Domains.Location'. at NHibernate.Impl.SessionImpl.Get[T](Object id) at Intellident.Core.Repository.NHibernate.NHibernateRepository.Get [T](Guid key) in ... There are no proxies involved in this. This seems to happen in a certain situation with data but I can't narrow it down yet. How can I be getting a proxy error with this anyway... no proxies are involved for this type of call surely? I'd try a Get<ILocation> but NH doesn't let me do that with themapping below as I get a "no persister" exception. I can add to the mapping (e.g. some kind of alias ?) but I can't replace the class name-"Location" with "ILocation". Mapping file for location: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Core.Domains" assembly="Core.Domains" default-access="field.camelcase-underscore" default-lazy="true"> <class name="Location" proxy="Core.Domains.Interfaces.ILocation, Core.Domains.Interfaces" table="Location" discriminator-value="0"> <id name="Id" column="Id" unsaved- value="00000000-0000-0000-0000-000000000000" access="property"> <generator class="guid.comb" /> </id> <discriminator column="Discriminator" type="byte" not-null="true" / > <version name="Version" column="Version" type="binary" unsaved- value="null" generated="always"/> <property name="Name" type="string" length="255" not-null="true" / > <many-to-one name="Parent" column="ParentId" class="Location" /> <many-to-one name="Category" column="LocationCategoryId" class="LocationCategory" not-null="true" /> <bag name="SubLocations" inverse="true" cascade="delete" optimistic-lock="false" > <key column="ParentId" /> <one-to-many class="Location" /> </bag> <bag name="Readers" inverse="true" cascade="none" optimistic- lock="false" > <key column="LocationId" on-delete="cascade" /> <one-to-many class="Intellident.Core.Domains.Hardware.ReaderComponent" /> </bag> <bag name="MovementsTo" inverse="true" cascade="delete" optimistic- lock="false" > <key column="ToId" /> <one-to-many class="Movement" /> </bag> <bag name="MovementsFrom" inverse="true" cascade="delete" optimistic-lock="false" > <key column="FromId" /> <one-to-many class="Movement" /> </bag> </class> </hibernate-mapping> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhusers@googlegroups.com To unsubscribe from this group, send email to nhusers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---