-->
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: Problem with custom Collection
PostPosted: Fri Jan 13, 2006 10:28 am 
Newbie

Joined: Fri Jan 13, 2006 10:20 am
Posts: 7
Hi. I have a problem.
I would to assign to a CustumCollection class a IList returned by CreateCriteria method.
In other words I would try a solution that make possible to execute this statement:

CustomCollection coll = (CutomCollection)session.CreateCriteria(typeof(Person)).List();

Someone can halp me?
Thanks,
Gianp.


Top
 Profile  
 
 Post subject: Re: Problem with custom Collection
PostPosted: Fri Jan 13, 2006 10:42 am 
Regular
Regular

Joined: Fri Feb 18, 2005 3:34 am
Posts: 88
Location: Poland/Wrocław
gianp wrote:
Hi. I have a problem.
CustomCollection coll = (CutomCollection)session.CreateCriteria(typeof(Person)).List();


Is your CustomCollection derrived from ArrayList? If so then do it so:

Code:
CustomCollection coll = new CustomCollection();
coll.AddRange(session.CreateCriteria(typeof(Person)).List());


If you do not have AddRange method then must iterate result collection and insert objects manually...

_________________
Please rate this post if you've found it helpfull
Roland


Top
 Profile  
 
 Post subject: Re: Problem with custom Collection
PostPosted: Fri Jan 13, 2006 10:59 am 
Newbie

Joined: Fri Jan 13, 2006 10:20 am
Posts: 7
Thanks for your response.
your suggestion work surely.
But I hoped to try a solution, (working on mapping xml), that return some object that i can cast directly whit my custom Collection, but I not be able to try this solution.
Bye.
Gianp.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 4:48 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
You will probably need to create a class that performs NHibernate access operations like IQuery.List(). The method(s) you create that internally calls IQuery.List() can massage the result set anyway it wants, and return any type it wants.


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.