-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: NHibernate "List()" bug?
PostPosted: Wed Mar 07, 2007 10:32 am 
Newbie

Joined: Mon Feb 12, 2007 10:53 am
Posts: 6
Hi,

I have the following situation:

- An entity with some "many-to-one" associations and a "one-to-many" association.
(I can send you the files and classes)
- When i define a criteria like this:

ICriteria criteria = session.CreateCriteria(typeof(MYENTITY));
criteria.SetTimeout(5000);
criteria.SetMaxResults(50);
criteria.SetFetchMode(MYENTITY_ONE_TO_MANY_PROPERTY_NAME, NHibernate.FetchMode.Join);
criteria.SetFetchMode(MYENTITY_MANY_TO_ONE_PROPERTY_NAME, NHibernate.FetchMode.Eager);

and then execute the query:

IList result = criteria.List();

I get the following error:"could not execute query..."
(innerException: "identifier type mismatch\r\nParameter name: id")
(StackTrace: " at NHibernate.Engine.EntityKey..ctor(Object id, Object identifierSpace, Type clazz, IType identifierType, Boolean isBatchLoadable, ISessionFactoryImplementor factory)\r\n at NHibernate.Engine.EntityKey..ctor(Object id, IEntityPersister p)\r\n at NHibernate.Loader.Loader.RegisterNonExists(EntityKey[] keys, ILoadable[] persisters, ISessionImplementor session)\r\n at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies)\r\n at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)\r\n at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)\r\n at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)")


So, what's wrong? Is this a bug?

Regards...


Top
 Profile  
 
 Post subject: FetchMode
PostPosted: Thu Mar 08, 2007 7:38 am 
Newbie

Joined: Mon Feb 12, 2007 10:53 am
Posts: 6
Note that if i change the FetchMode in this statement:

criteria.SetFetchMode(MYENTITY_MANY_TO_ONE_PROPERTY_NAME, NHibernate.FetchMode.Eager);

to:

criteria.SetFetchMode(MYENTITY_MANY_TO_ONE_PROPERTY_NAME, NHibernate.FetchMode.Select);

It works, but it doesn't fetch data eagerly!

If i use this:

criteria.SetFetchMode(MYENTITY_MANY_TO_ONE_PROPERTY_NAME, NHibernate.FetchMode.Join);
(and outer-join="false")

it doesn't work either.

Regards...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 6:34 am 
Newbie

Joined: Mon Feb 12, 2007 10:53 am
Posts: 6
Anyone??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 8:46 pm 
Newbie

Joined: Sun Sep 10, 2006 12:27 pm
Posts: 13
I have the same problem .... someone have found a solution?

If I a use an HQL query instead of Criteria Query it works


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.