EDIT: Deleted the original question. After reading, I realised that I would have to paste so much additional code that it would take someone a couple of days just to understand what was happening in my own code that it may detract from the issue at hand.
Problem: When I add an object to a collection (many-to-many relationship) the object is saved and committed to the database. However, if I then try and retrieve that object somewhere else (on a different thread) the object state is incorrect and the collection does not contain the recently added item.
Checking the database shows that the item has been added successfully.
Does anyone know what would cause NHibernate to do this? Googling revealed that it's generally a problem with not having an Inverse relationship. However, I've tried with and without and inverse map and the problem still occurs.
Also, the problem ONLY occurs if I attempt to retrieve data from a different object/method than the one that originally saved the data.
I would post code, but it really wouldn't be helpful and I would have to post about 1,000+ lines just so that you could get the context. (The Domain Objects, the Interfaces, the NHibernate Data Access Objects, the Service Code, the Test Code etc.)
There is a lot ^^
Edited 6 Years Ago by Ketsuekiame: n/a