Hi,

I have an interesting case...

I have a Group entity which can be nested (think parent groups which
can have children groups).
A Group can hold Articles (one to many)
An Article has a Type (Normal, Breaking, etc...)

Now...I want to make a query to get me the complete object graph for a
certain article type...say that the use case is...show a grouped list
of all "breaking" articles.

My initial idea was to make this into a multi query:
1st query --> get all Groups (there will be max 20 groups
ALWAYS...unbound set is very unlikely to happen)
2nd query --> get all Articles by Article type "Breaking"

NHibernate's engine would tie the references together, and with a
simple and effective query I could easily show the complete structure
of Groups (nesting levels are not limited), along with their belonging
Articles.

It does work...however...

As I later do a "foreach" on the groups to show the structure, NH goes
to Lazy load the missing articles from the DB (ones not retreived by
2nd query in Multi query), which is not exactly what I want.


...One natural solution would be to write the 1st query with
Restrictions to load only the Groups with Articles of a given Type,
but that would be simple if the groups were not nested (just add alias
and a join and of you go...). However, as Group nesting is not
limited, I am not sure if that kind of query can be written in NH.
Query put in words...give me all the Groups which have an Article of a
given type, or have a Child Group which has such an Article, or which
has a Child's Child Group...(as you can imagine, the recursion can go
on)...

...Other solution would be to tell NH somehow...what I've loaded so
far is IT. Don't load anything else later, and don't load anything
more now, other than what I told you to...which basically
means...disable both eager and lazy loading...

I am not sure if I've explained the issue with enough detail, please
ask if I haven't.

Anyone has a clue where to start?


Thank you!

Vladan Strigo
--~--~---------~--~----~------------~-------~--~----~
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