If you are dealing w/ 100k records, you should really be thinking about 
doing this outside of nhibernate. There are a lot of problems associated 
with large result sets like that (mainly memory but also easily cpu / 
network). Depending on how many parameters there are, it would probably not 
be that complicated of a stored procedure. 

On Monday, July 30, 2012 8:31:15 AM UTC-6, Jochen Jonckheere wrote:
>
> Unfortunately the number of records can be very high (+100k), a single 
> query is a must or maybe multiple queries like batching per 1000.
>
>
> On Monday, July 30, 2012 3:55:34 PM UTC+2, Jason Meckley wrote:
>>
>> what you are asking for, no I don't think that's possible. you are mixing 
>> object graphs with sql statements and they get's real messy real fast. 
>> Instead I would manage this through objects and let NH deal with the sql 
>> statements.
>> how about:
>>
>>   var books = session.Query<Book>().Where(...).Futures();
>>   foreach(var book in books)
>>   {
>>        var mybook = new MyBook(book...);
>>        session.Save(mybook);
>>   }
>>
>> //tx.Commit();
>>
>> Depending on your POID this will batch the write statements together. If 
>> you are using HiLo or guid as ids the saves are batched together as a 
>> single db call. If you are using Identity or another DB-centric POID than 
>> the statements are executed individually. Depending on the number of 
>> records expected to return from the books query individual insert 
>> statements may or may not be acceptable.
>>
>> On Monday, July 30, 2012 9:02:19 AM UTC-4, Jochen Jonckheere wrote:
>>>
>>> Hi,
>>>
>>> For a project I'm working on I want to do some DLM stuff with 
>>> NHibernate, I know not the best option. But anyway I'm stuck on complex 
>>> where statement.
>>>
>>> On the screen a user can select multiple parameters to do a search and 
>>> in code this generates some linq-code that is than executed via NHibernate. 
>>> Example: _session.Query<Book>().Where(b => b.ISBN.StartsWith("10025") && 
>>> b.Pages > 100 && b.Author.Name == "Jochen" && ...)
>>>
>>> But now I want to use that Where part in combination with INSERT INTO. 
>>> An insert into that only works via hql or sql.
>>> Example: _session.CreateQuery("insert into MyBooks (Id, NumberOfPages) 
>>> select b.Id, b.Pages where ... (and here should the linq part be inserted)
>>>
>>> Is it possible to mix Linq and Hql? Or is there a better solution to 
>>> this problem.
>>>
>>> Regards,
>>>
>>> Jochen
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/1WKEWka0WzwJ.
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