-->
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.  [ 2 posts ] 
Author Message
 Post subject: NHibernate.AssertionFailure: bug in CollectionType
PostPosted: Wed Sep 26, 2007 5:03 am 
Beginner
Beginner

Joined: Mon May 14, 2007 2:50 am
Posts: 22
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
1.2


Code between sessionFactory.openSession() and session.close():
I generate an ICriteria query, which makes use of a lot property projections

Name and version of the database you are using:
Firebird

Debug level Hibernate log excerpt:

NHibernate.ADOException: could not execute query
[ SELECT this_.NAME as y0_, this_.ACCOUNT_NR as y1_, this_.ID as y2_, this_.ID as y3_, district27x1_.UNIQUE_CODE as y4_, district27x1_.Name as y5_, district27x1_.Blocked as y6_, responsibl2_.NAME as y7_, responsibl2_.SURNAME as y8_, area29x3_.UNIQUE_CODE as y9_, this_.NR as y10_, this_.VATCODE as y11_, this_.FOREIGNER as y12_, this_.ADDRESS as y13_, this_.LINK1 as y14_, this_.LINK2 as y15_, this_.LINK3 as y16_, this_.FAX as y17_, this_.SUBSCRIBER_NAME as y18_, this_.CODE as y19_, this_.CONTRACT_NR as y20_, contractsi4_.Name as y21_, this_.HOME_PAGE as y22_, responsibl2_.NAME_SURNAME as y23_, this_.ID as y24_ FROM CLIENT this_ left outer join DISTRICT_CLASSIFICATORS district27x1_ on this_.DISTRICT_ID=district27x1_.ID left outer join RisingStar_USERS responsibl2_ on this_.RESPONSIBLE_USER_ID=responsibl2_.ID left outer join AREA_CLASSIFICATORS area29x3_ on this_.AREA_ID=area29x3_.ID left outer join CONTRACT_SIGN_T_CLASSIFICATORS contractsi4_ on this_.CONTRACT_SIGN_TYPE_ID=contractsi4_.ID ]
[SQL: SELECT this_.NAME as y0_, this_.ACCOUNT_NR as y1_, this_.ID as y2_, this_.ID as y3_, district27x1_.UNIQUE_CODE as y4_, district27x1_.Name as y5_, district27x1_.Blocked as y6_, responsibl2_.NAME as y7_, responsibl2_.SURNAME as y8_, area29x3_.UNIQUE_CODE as y9_, this_.NR as y10_, this_.VATCODE as y11_, this_.FOREIGNER as y12_, this_.ADDRESS as y13_, this_.LINK1 as y14_, this_.LINK2 as y15_, this_.LINK3 as y16_, this_.FAX as y17_, this_.SUBSCRIBER_NAME as y18_, this_.CODE as y19_, this_.CONTRACT_NR as y20_, contractsi4_.Name as y21_, this_.HOME_PAGE as y22_, responsibl2_.NAME_SURNAME as y23_, this_.ID as y24_ FROM CLIENT this_ left outer join DISTRICT_CLASSIFICATORS district27x1_ on this_.DISTRICT_ID=district27x1_.ID left outer join RisingStar_USERS responsibl2_ on this_.RESPONSIBLE_USER_ID=responsibl2_.ID left outer join AREA_CLASSIFICATORS area29x3_ on this_.AREA_ID=area29x3_.ID left outer join CONTRACT_SIGN_T_CLASSIFICATORS contractsi4_ on this_.CONTRACT_SIGN_TYPE_ID=contractsi4_.ID] ---> NHibernate.AssertionFailure: bug in CollectionType
at NHibernate.Type.CollectionType.NullSafeGet(IDataReader rs, String name, ISessionImplementor session, Object owner)
at NHibernate.Loader.Criteria.CriteriaLoader.GetResultColumnOrRow(Object[] row, IResultTransformer resultTransformer, IDataReader rs, ISessionImplementor session)
at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies)
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)
--- End of inner exception stack trace ---
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
at NHibernate.Impl.CriteriaImpl.List()
at DLC.Core.Domain.Bindables.BookBinder.get_DomainObjectValue() in c:\Projects\CoreBookBranch\DLC.Core\Domain\Bindables\BookBinder.cs:line 98


Is this probably mine bug or NHibernate? :)

p.s.
I'll try to make unit tests, which would show how it fails in the evening


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 5:22 am 
Beginner
Beginner

Joined: Mon May 14, 2007 2:50 am
Posts: 22
Ok, the bug is in my code.
What i tried to do is I added a property projection into criteria query. However, it was not an ordinary property, it was a oneToMany relationship.

To illustrate: I tried to add column "Tasks" (a collection of objects Task) from an object Client.

Apparently, it makes no sense.


However, NHibernate's behaviour is not expected either.
I would expect that nhibernate would not allow to make this projection.

I'll check the source of NHibernate, if i manage to fix it in one hour, then i'll send a patch and will write a test case for it.

Of course, it would be nice if someone confirmed is this expected or not expected behaviour of NHiberante


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.