Hello Everyone,
I am finding problem to bind datagrid. I am using nHibernate. I've two classes of one-t-many relationships. When i try to populate grid using nHibernate, i get following exception:
Exception:
NHibernate.PropertyAccessException: Invalid Cast (check your mapping for property type mismatches); setter of BusinessClassess.products ---> System.InvalidCastException: Unable to cast object of type 'NHibernate.Collection.PersistentSet' to type 'BusinessClassess.order'. at (Object , Object[] , SetterCallback ) at NHibernate.Bytecode.Lightweight.SetPropertyValuesInvoker.Invoke(Object obj, Object[] values, SetterCallback callback) at NHibernate.Bytecode.Lightweight.AccessOptimizer.SetPropertyValues(Object target, Object[] values) at NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValuesWithOptimizer(Object entity, Object[] values) --- End of inner exception stack trace --- at NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValuesWithOptimizer(Object entity, Object[] values) at NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValues(Object entity, Object[] values) at NHibernate.Persister.Entity.AbstractEntityPersister.SetPropertyValues(Object obj, Object[] values, EntityMode entityMode) at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, PostLoadEvent postLoadEvent) at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean readOnly) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) at NHibernate.Hql.Classic.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters) at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results) at NHibernate.Impl.SessionImpl.List(String query, QueryParameters queryParameters, IList results) at NHibernate.Impl.SessionImpl.List[T](String query, QueryParameters parameters) at NHibernate.Impl.QueryImpl.List[T]() at BusinessClassess.products.selectProducts() in F:\Rnd Material\nHibernation\Sample Hibernate\ProductOrder\PointofSale\ProductOrders\BusinessClassess\products.cs:line 56 at WebApplication1.administrator.registerProducts.bindGrid() in F:\Rnd Material\nHibernation\Sample Hibernate\ProductOrder\PointofSale\ProductOrders\WebApplication1\administrator\registerProducts.aspx.cs:line 63 Can anyone help me regarding this issue. Its so urgent, so please help me to solve this issue. Waiting for quick response. Thanks in advance.
|