Here is aother strange problem related with NHibernate

The Problem

I have a Parent class and two child classes Child1 and Child2 mapped to different tables on the database.
Lets assume that we specified cascade='all' for child bags defined on Parent.hbm.xml. Sample workflow of instantiating parent and child objects is as the following

- Create a parent object.
- Insert 2 Child1 instances to child1 bag
- Insert 3 Child2 instances to child2 bag.
- Flush the session
- Refresh parent object
- We get 6 instances for each child bag (child1 and child2). But we expect 2 Child1 instances in child1 bag and 3 Child2 instances in child2 bag.

Ther problem is : NHibernate performs left outer join on Child1 and Child2 tables when Refresh is called for the parent object. This is unaccaptable, I think NHibernate should initialize child collections with seperate selects commited to the database, or may be distinguish the duplicated child instances automatically in the collections. (using idbag instead of bag is not an option)

Download the test case

Requirements

Watch This


Posted in: .NET Development , C# , NHibernate  Tags:

Comments


January 21. 2009 18:19
Busby SEO Test
thanks for sharing some ideas here i really appreciate, well said about you post

   http://pinayspeak.com/pinaytest/


March 28. 2009 05:20
тексты песен
very cool, thx!

   http://www.lyrics.wmline.com/


April 6. 2009 21:38
Handbags
Yeah.. sometimes NHibernate is doing unwanted jobs.
That's why I hate it.

   http://www.womenshandbagshop.com/


May 8. 2009 10:54
Melayu Boleh
yes good

   http://melayubolehla.blogspot.com/


May 14. 2009 20:36
Melayu Boleh
Thanks for sharing the download link..

   http://www.melayuboleh1.co.cc/


May 22. 2009 01:06
tukang nggame
what a great post, thanks.

   http://belajarseo.com/bebas/tukang-nggame-seo-contest.php


June 1. 2009 11:33
Melayu Boleh Online
The post really help me! thanks a lot.

   http://melayubolehonline.blogspot.com/


June 28. 2009 19:33
moratmarit
Thanks for information.nice post.

   http://www.moratmarit.com/2009/06/stop-dreaming-start-action.html


July 1. 2009 12:31
Income protection
Nice stuff.This is my first time i visit here. I found so many interesting in your blog especially its discussion.Keep your blog updating,good luck...

   http://www.ratedetective.com.au/insurance/income-protection


United States SEO
July 2. 2009 08:45
SEO
Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work.

   http://www.webmarketingexperts.com.au/


July 2. 2009 22:32
blogger
thanks friend for u information..this very usefull.

   http://blogger.moratmarit.com/


July 6. 2009 01:50
Jack
Thanks a lot.. great post

   http://www.google.com/


July 14. 2009 02:54
Baume Mercier
Hmm strange this post is totaly irrelevant to the search query I entered in google but it was listed on the first page.

   http://thewatchshop.biz/


New Zealand Jay
July 18. 2009 09:54
Jay
I hadn't been using my rss reader for a while and I have a huge backlog of stuff to catch up on. Glad to have taken to time to catch up on your blog though. Cheers.

   http://makemoneyonline.net.nz/


July 18. 2009 09:54
Ella
I hadn't been using my rss reader for a while and I have a huge backlog of stuff to catch up on. Glad to have taken to time to catch up on your blog though. Cheers.

   http://makemoneyonline.net.nz/


July 20. 2009 04:10
club penguin cheats
Sometimes NHibernate is doing unwanted jobs. That's why I hate it.

   http://www.club-penguin.org/


July 20. 2009 08:16
anne of green gables dvd
Very informative. Thanks a lot!

   http://www.anne-of-green-gables-dvd.com/


July 22. 2009 03:04
Patek Phillipe
Would you like to post a guest post on my blog?

   http://discountwatchstore.biz/


July 23. 2009 08:14
Buy Acai Berry
Great write up - Thank you for sharing..

   http://www.kaneva.com/channel/Acai_Berry.people


July 23. 2009 08:14
Slankepiller
Thanks - Just the info I was looking for.. My search ends here..

   http://blog.tv2.dk/hoodia_danmark/entry324904.html


July 24. 2009 16:44
water proof digital cameras
Yeah.. sometimes NHibernate is doing unwanted jobs.
That's why I hate it.

   http://waterproof-digital-cameras.org/


July 26. 2009 17:28
grow taller
NHibernate is doing unwanted jobs all the time man!

   http://howtogrowtaller101.com/


July 30. 2009 14:08
seo company
The topic which you have discussed is very informative as well as valuable for all...Thanks for providing this information for us....

   http://www.uneedhits.com/

Comments are closed