-->
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: Unable to cast to ICollection during cascade delete
PostPosted: Sun Nov 16, 2008 11:31 am 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
Hibernate version: 2.0 GA

I am testing my custom collection, which inherits from PersistentGenericBag<T>. Initial tests worked fine until I enabled cascade="all-delete-orphan". Now my tests are failing with this message:

System.InvalidCastException: Unable to cast object of type 'Mc.Collections.Bag`1[Mc.NHibernate.Collections.Tests.Entities.OrderLine]' to type 'System.Collections.ICollection'.

I tried implementing ICollection on my bag but Resharper complains that it is redundant since I am inheriting from PersistentGenericBag<T> which implements IList, there by implementing ICollection. So how come it cannot cast it to ICollection. Does it have to do something with proxies maybe. I am lazy loading my collections.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 16, 2008 12:13 pm 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
Problem was not in PersistantBag, but in the bag that is in the place until NHibernate injects my mapped type.


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.