Having created a functional test project using nHibernate with all the typical trimmings I’ve got a very good handle on how I can leverage nHibernate, well at least as much as I can so far. However, I’m wondering how other developers handle scenarios where the application needs to retreive data from the backend database that may run complex queries with joins / grouping for say reporting purposes or other tasks that fall outside of the OO paradigm.
Should I take the pure route of utilising nHibernate to execute these queries and fill the appropriate Repository objects regardless of its performance OR should I simply go straight the database passing a dataset back through the business layer?
Ultimately I’m comfortable using nHibernate for interacting with simple and complex business objects but there are situations where I feel that simply delving into the database makes more sense, and working as the only .NET developer atm I’m very interested in how other devs have handled this situation…
Thanks in advance
Be pragmatic about it.
Many “complex” queries can be easily expressed in HQL, but if SQL is a better fit for some, by all means use it.
The reporting scenarios in particular are usually better suited for reporting tools that go directly against the DB.