Debugging NHibernate
Today we had a problem with an NHibernate query that was failing which had quite stumped. Pulling the usual tricks didn't work, debugging NHibernate was problematic, since the failing query was damn complex, and I had no clear idea why this was failing. After a while, I decided that trying the top down approach will not work, and that I need more structure in finding out the issue.
Did I mentioned that the query was complex? The object model is big as well, and the query managed to touch just about all of it. Getting it slimmed down to a reproducable version was hard, because I wasn't sure what caused the issue, but eventually I managed to get it to fail the way I wanted it. (In the process I walked through parts of NHibernate that I haven't met before, interesting.
The end result are these tests (there is a reason that I know that C# has a 512 characters limits on identifiers):
- CanMakeCriteriaQueryAcrossBothAssociationsWhenBothAssoicationsHasSameColumnKeyNameAndUsingPagingInSqlServer2005
- CanLoadCollectionUsingLeftOuterJoinWhenBothCollectionsHasTheSameColumnKeyNameAndOneIsNull
I still don't have an answer, but now I have much harder questions...
Comments
There is a point at which comments once again become more useful than method names!!!!!
...Or you can break the name in a subclass/method pair. Even better if you find commonalities:
[TestFixture]
public class CanMakeCriteriaQueryAcrossBothAssociations
{
}
If you are using NUnit and making the names long to give a better description, you might want to consider using the Description attribute instead. This way you can keep your method names a little more succint and still give a decent error message in the output on failure
http://nunit.com/index.php?p=description&r=2.4.1
Comment preview