public class Country
{
...
...
public IEnumerable<Person> People{get; private set;}
}

using(var session = sf.OpenSession())
{
   var china = s.QueryOver<Country>().Where(x=> x.Name ==
"China").SingleOrDefault();
   foreach(var person in china.People)
{
  DoSomethingButComeBackTomorrowToSeeResult();
}
}

The link that Roger gave you is correct what is incorrect is the design of
the domain.

On Mon, Apr 4, 2011 at 2:33 PM, Dzyann Leleur <[email protected]> wrote:

> Hi Fabio,
> What do you mean with that trying to map a collection that big is wrong? Do
> you mean like I shouldn't use NHibernate? Or that the collection shouldn't
> be that big?
> The collection is being created by a service, we don't have a choice but
> having that collection, there is no other way. The service is not working
> with Nhibernate to create the data. We are using Nhibernate for the User
> interface part, that creates queries on the data. But has the option to
> delete them too.
>
> When I saw how Nhibernate was behaving, I thought that maybe I shouldnt try
> to delete the collection with Nhibernate and just do it with SQL, but I
> wanted to see different options.
> I am going to try the "on-delete="cascade"", but, was the approach I
> implemented following the link:
>
> http://www.nhforge.org/doc/nh/en/index.html#performance-collections-oneshotdelete
> that Roger gave me, wrong?
>
> Regards,
>
> Dzy.-
>
> On Sun, Apr 3, 2011 at 10:04 PM, Fabio Maulo <[email protected]> wrote:
>
>> try to map a collection with 95K items is simple wrong and nothing more.
>> btw you can use on-delete="cascade"
>>
>>
>> On Fri, Apr 1, 2011 at 6:23 PM, Dzyann <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have a an entity Query that has a lot of items Metadata in a
>>> relation "one-to-many".
>>> When I delete the Query, I want all its childs to be delete too, so I
>>> set cascade to all-delete-orphan.
>>>
>>> The items get deleted, but it takes a lot of time. The query can have
>>> many items, lets say 95k items.
>>> I checked out with the SQL Profiler to see what was going on, and I
>>> saw that each Metadata Item is getting deleted one by one like:
>>>
>>> exec sp_executesql N'DELETE FROM MyDatabase.dbo.[QueryMetadata] WHERE
>>> Id = @p0',N'@p0 int',@p0=302401
>>>
>>> This takes time, and produces a bad user experience. I would like to
>>> hear out any recommendations.
>>> Maybe is better if I delete the items with a sql sentence?
>>>
>>> Thanks in advance for your help!
>>>
>>> Dzy.-
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "nhusers" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>>
>>
>>
>> --
>> Fabio Maulo
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>



-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to