[nhusers] Re: Eagerly load recursive relation

2009-08-04 Thread HappyNomad
: Eagerly load recursive relation Kids speak: Can you write a SQL query and execute that in your RDBM's tools that loads something recursively? HappyNomad wrote: Really sorry, but I'm still drawing a blank.  If you provide some sample code then it would be easier for me

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Fabio Maulo
Can you write a SQL to eagerly load recursive relation ? 2009/8/3 HappyNomad happynomad...@gmail.com I have a recursive one-to-many relationship that has the default lazy value of true. How can I execute a query which recursively retrieves the ENTIRE tree? Here's the recursive one-to-many

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
Hi Fabio, thanks for the reply. But I'm not sure I understand the nature of your question. In any case, the query would need to be in HQL, and not SQL, since I need to load the actual objects, and not just scalar values. On Aug 3, 4:32 pm, Fabio Maulo fabioma...@gmail.com wrote: Can you

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Fabio Maulo
Ok but... Can you write an SQL to eagerly load recursive relation ? 2009/8/3 HappyNomad happynomad...@gmail.com Hi Fabio, thanks for the reply. But I'm not sure I understand the nature of your question. In any case, the query would need to be in HQL, and not SQL, since I need to load the

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
Really sorry, but I'm still drawing a blank. If you provide some sample code then it would be easier for me to understand your suggestion. On Aug 3, 4:41 pm, Fabio Maulo fabioma...@gmail.com wrote: Ok but... Can you write an SQL to eagerly load recursive relation ? 2009/8/3 HappyNomad

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Kim Johansson
Kids speak: Can you write a SQL query and execute that in your RDBM's tools that loads something recursively? HappyNomad wrote: Really sorry, but I'm still drawing a blank. If you provide some sample code then it would be easier for me to understand your suggestion. On Aug 3, 4:41 pm,

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Fabio Maulo
2009/8/3 HappyNomad happynomad...@gmail.com Really sorry, but I'm still drawing a blank. If you provide some sample code then it would be easier for me to understand your suggestion. The sample is exactly what I'm asking you. Can you write a SQL to eagerly load recursive relation ? --

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
The SQL to eagerly load the recursive relation would be the same as what NH generates if I were to add lazy=true onto the SubCategories's list mapping in my OP, and then execute this query: string s = from Category as t where t.ParentCategory is null; session.CreateQuery( s ).ListCategory();

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
My database is SQL Compact, which does not support CTEs. Although, as you can see from the outputted SQL in my previous post, it successfully uses sub-selects to optimally load the tree. On Aug 3, 4:53 pm, Kim Johansson hagbarddenst...@gmail.com wrote: Kids speak: Can you write a SQL query

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Fabio Maulo
HappyNomad,What NH do with lazy=false is: load- investigate-load load- investigate-load load- investigate-load load- investigate-load So it run many SQL with many roundtrips What you are asking is eagerly load recursive relation that mean load the entirely three in one roundtrip. The question

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Fabio Maulo
Sorry I mean the entirely tree in one roundtrip obviously. [?] 2009/8/3 Fabio Maulo fabioma...@gmail.com HappyNomad,What NH do with lazy=false is: load- investigate-load load- investigate-load load- investigate-load load- investigate-load So it run many SQL with many roundtrips What you

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
I am not asking about how to load the entire tree in one round trip. I've already investigated that issue, and it is impossible for my database (CTEs are not supported by SQL Compact). What I'm asking is: what code can I write against the NH API that will retrieve the entire Category tree AS IF

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Dmitiry Nagirnyak
I would first ask for your use-case. Why do you need to load all tree via query ONLY? Why can't you use different optimizations (fetch types etc) and retrieve the root of tree and then get all the rest the object. Yes, it won't make it in a single query. But you could easily flatten it to a

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
Hi Dmitiry, thanks for trying to answer my question. I need a query that loads the entire tree because it gets displayed in a TreeView user-interface control. It's a sizable tree, but in reality it only takes just half a second to load using subselect fetch optimization. Regarding your

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Cesar Sanz
A SQL sentences that when executed in your RDBMS returns your records recursively!! Original Message - From: Kim Johansson To: nhusers@googlegroups.com Sent: Monday, August 03, 2009 3:53 AM Subject: [nhusers] Re: Eagerly load recursive relation Kids speak: Can you write

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Dmitiry Nagirnyak
sentences that when executed in your RDBMS returns your records recursively!! Original Message - *From:* Kim Johansson hagbarddenst...@gmail.com *To:* nhusers@googlegroups.com *Sent:* Monday, August 03, 2009 3:53 AM *Subject:* [nhusers] Re: Eagerly load recursive relation Kids speak

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
Johansson hagbarddenst...@gmail.com *To:* nhusers@googlegroups.com *Sent:* Monday, August 03, 2009 3:53 AM *Subject:* [nhusers] Re: Eagerly load recursive relation Kids speak: Can you write a SQL query and execute that in your RDBM's tools that loads something recursively? HappyNomad

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Dmitiry Nagirnyak
@googlegroups.com *Sent:* Monday, August 03, 2009 3:53 AM *Subject:* [nhusers] Re: Eagerly load recursive relation Kids speak: Can you write a SQL query and execute that in your RDBM's tools that loads something recursively? HappyNomad wrote: Really sorry, but I'm still drawing a blank

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread HappyNomad
:* [nhusers] Re: Eagerly load recursive relation Kids speak: Can you write a SQL query and execute that in your RDBM's tools that loads something recursively? HappyNomad wrote: Really sorry, but I'm still drawing a blank.  If you provide some sample code then it would be easier