I just ran into this problem for an hour, and I was annoyingly found the problem in the end.
CIRCUMSTANCES
I have a table in which the user enters a string as a primary key, this table has many relationships from several to one and from many to many of this primary key.
When searching for multiple items from a table, all relationships were returned. However, whenever I tried to get an object using the primary key (string), it did not return any links, they were always 0.
PARTIAL SOLUTION
So, I looked in my logs to see what SQL does and what returned the correct results. Therefore, I tried many different things, and in the end it was. The case of the string passed to the get method was NOT EXACTLY in the same case as in the database, so when he tried to match the elements of the relations with the main entity, he did not find anything (or at least NHIbernate not because as I said above, SQL actually returned the correct results)
REAL SOLUTION
Has anyone else come across this? If so, how do you tell NHibernate to ignore the case of matching SQL results with an entity? This is stupid, because it worked perfectly before suddenly he began to pay attention to the string case.