Sorry, my previous message wasn't clear. I made the changes that Fabio suggested, and now I can save correctly, but when loading from that table, I get the exception I just posted.
On Nov 12, 12:57 pm, Jon Stelly <[EMAIL PROTECTED]> wrote: > interesting, maybe I misread the <any> documentation, but it made it > sound like you had to specify a <meta-value>. > > I forgot to mention, I'm using the latest 2.0 build. It looks like > the TargetEntityType column gets set to the name of the class (just > the name, no namespace or assembly information) but then when I try to > load from the table, I get the following exception. Any ideas? Also, > thanks for the quick help so far. > > NHibernate.MappingException: No persister for: Site > at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String > entityName, Boolean throwIfNotFound) in Impl > \SessionFactoryImpl.cs:line 766 > at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String > entityName) in Impl\SessionFactoryImpl.cs:line 752 > at NHibernate.Event.Default.DefaultLoadEventListener.OnLoad > (LoadEvent event, LoadType loadType) in Event\Default > \DefaultLoadEventListener.cs:line 37 > at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType > loadType) in Impl\SessionImpl.cs:line 2055 > at NHibernate.Impl.SessionImpl.InternalLoad(String entityName, > Object id, Boolean eager, Boolean isNullable) in Impl > \SessionImpl.cs:line 1068 > at NHibernate.Type.AnyType.ResolveAny(String entityName, Object id, > ISessionImplementor session) in Type\AnyType.cs:line 396 > at NHibernate.Type.AnyType.ResolveIdentifier(Object value, > ISessionImplementor session, Object owner) in Type\AnyType.cs:line 107 > at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, > Boolean readOnly, ISessionImplementor session, PreLoadEvent > preLoadEvent, PostLoadEvent postLoadEvent) in Engine > \TwoPhaseLoad.cs:line 69 > at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList > hydratedObjects, Object resultSetId, ISessionImplementor session, > Boolean readOnly) in Loader\Loader.cs:line 617 > at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, > QueryParameters queryParameters, Boolean returnProxies) in Loader > \Loader.cs:line 466 > at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections > (ISessionImplementor session, QueryParameters queryParameters, Boolean > returnProxies) in Loader\Loader.cs:line 187 > at NHibernate.Loader.Loader.LoadCollection(ISessionImplementor > session, Object id, IType type) in Loader\Loader.cs:line 1603 > at NHibernate.Loader.Collection.CollectionLoader.Initialize(Object > id, ISessionImplementor session) in Loader\Collection > \CollectionLoader.cs:line 30 > at > NHibernate.Persister.Collection.AbstractCollectionPersister.Initialize > (Object key, ISessionImplementor session) in Persister\Collection > \AbstractCollectionPersister.cs:line 527 > at > NHibernate.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection > (InitializeCollectionEvent event) in Event\Default > \DefaultInitializeCollectionEventListener.cs:line 42 > at NHibernate.Impl.SessionImpl.InitializeCollection > (IPersistentCollection collection, Boolean writing) in Impl > \SessionImpl.cs:line 1342 > at > NHibernate.Collection.AbstractPersistentCollection.ForceInitialization > () in Collection\AbstractPersistentCollection.cs:line 462 > at > NHibernate.Engine.StatefulPersistenceContext.InitializeNonLazyCollections > () in Engine\StatefulPersistenceContext.cs:line 901 > at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections > (ISessionImplementor session, QueryParameters queryParameters, Boolean > returnProxies) in Loader\Loader.cs:line 193 > at NHibernate.Loader.Loader.DoList(ISessionImplementor session, > QueryParameters queryParameters) in Loader\Loader.cs:line 1808 > at NHibernate.Loader.Loader.ListIgnoreQueryCache > (ISessionImplementor session, QueryParameters queryParameters) in > Loader\Loader.cs:line 1718 > at NHibernate.Loader.Loader.List(ISessionImplementor session, > QueryParameters queryParameters, ISet`1 querySpaces, IType[] > resultTypes) in Loader\Loader.cs:line 1712 > at NHibernate.Hql.Classic.QueryTranslator.List(ISessionImplementor > session, QueryParameters queryParameters) in Hql\Classic > \QueryTranslator.cs:line 1286 > at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters > queryParameters, ISessionImplementor session, IList results) in Engine > \Query\HQLQueryPlan.cs:line 226 > at NHibernate.Impl.SessionImpl.List(String query, QueryParameters > queryParameters, IList results) in Impl\SessionImpl.cs:line 520 > at NHibernate.Impl.SessionImpl.List[T](String query, > QueryParameters parameters) in Impl\SessionImpl.cs:line 499 > at NHibernate.Impl.QueryImpl.List[T]() in Impl\QueryImpl.cs:line 95 > > On Nov 12, 9:52 am, "Fabio Maulo" <[EMAIL PROTECTED]> wrote: > > > 2008/11/12 Jon Stelly <[EMAIL PROTECTED]> > > > > Does this mean I'd need to specify a <meta-value> > > > for any possible derived type that could end up in TargetEntity? This > > > would be over 200 different values, and I'd need to constantly keep > > > this <any> relationship updated with new releases. > > > Not that mean that you want specify the meta-value. > > Remove the <meta-type> and <meta-value> from the mapping. > > Define : <column name="TargetEntityType" length="500"/> > > And take a look about what happen ;) > > > I don't know your use case but in NH2.1 (trunk) you can use generics and > > avoid > > <any>.http://fabiomaulo.blogspot.com/2008/10/entity-name-in-action-strongly... > > > and the same but changing the > > mappinghttp://fabiomaulo.blogspot.com/2008/10/power-of-orm.html > > > -- > > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
