A <bag> collection with composite-id is not been fetched on version 3.x.x
Description
Environment
Attachments
is related to
Activity
André Luiz Ferreira Dias August 19, 2014 at 3:00 AM
No. I'm still having the mentioned problem... i could not create a sample application, but my scenario it's quite simple, it's just the mapping file attached running on an environment with SQL Server 2012 DBMS.
Alex Zaytsev August 19, 2014 at 2:54 AM
@André Luiz Ferreira Dias any news?
André Luiz Ferreira Dias July 27, 2014 at 2:02 AM
Forget what I sad, I've tested here and this implementation has nothing to do with my problem, I'll try to create a simple application to simulate the problem and then upload it.
André Luiz Ferreira Dias July 27, 2014 at 12:40 AM(edited)
I don't know if this causes some different behavior, but the method Equals that was overrided on the class ItemNotaFiscal it's implemented a litle bit different on my application, it is exactly like this:
public override bool Equals(object obj)
{
if (obj == null || !(obj is ItemNotaFiscal))
return false;
if (ReferenceEquals(this, obj))
return true;
ItemNotaFiscal passedObj = (ItemNotaFiscal)obj;
return (passedObj.NotaFiscal == NotaFiscal) && (passedObj.Produto == Produto);
}
That is, it contains a comparison with null in the first conditional of the method, this has anything to do with my problem?
Oskar Berggren July 26, 2014 at 11:53 PM(edited)
I meant that you should write a test case. The classes you attached do help. I had to tweak them and the mapping file a little before it compiled. But a simple case I tried works as expected - the members of the <bag> are loaded.
So to proceed on this we would need more information on when and how the situation occurs - how the bag owner is loaded etc. It would be really helpful and speed things up if you could provide a small and self-contained test case that works on 2.1.0 but fails on 3.3.3.
I have the attached mapping file that is perfectly working on versions 2.1.0 of NHibernate and when I upgrade to the version 3.x.x it stopped to work. I don't know if this is a breaking change, but in my opinion, this behavior should not be different after the version upgrade.