NHibernate for Reporting...
Just finished writing some fairly complex reports. The reports are complex enough that I decided that it isn't worth my time to try to build a stored procedure to do it, and I simply used NHibernate to get the data. The simplest report had 14(!) parameters, but the main issue was handling security and running business logic as part of the report. (Specifically, a lot of date calculations).
To be clear, I am talking about using NHibernate as a data source for a report, not generating the report itself. That is done with reporting services, which is talking to an NHibernate backed Web Service. Of course, this has the predictable result of:
ReasonsForDislike.DoesNotSupportRightToLeft | ReasonsForDislike.XPathWhoNeedsXPath );
Comments
Ouch... We're considering moving from Crystal Reports, which is just disgusting, and I thought SQL Server Reporting Services sounded interesting - but if it doesn't support RTL...
Did you come up with a workaround?
We got some help from Microsoft, turned out to be a HttpModule that just processed the outgoing HTML and added dir="rtl", but that breaks horribly on aggregation.
Why do you need RTL?
No workaround yet, this is one situation where I can tell the customer, you wanted Microsoft, now you deal with it. Not that I would have another solution, by the way, it is just that I have fun saying that ;-)
I've been thinking about using NHibernate on my next project but have been reluctant because of reporting.Its a rich client app and i'm stuck with Crystal Reports which as far as i can tell only takes DataSets as report data source.Any ideas on how i would feed NHibernate query results to such a tool?
We need RTL because one of the languages we produce reports in is Arabic. Oh well, there are other reporting products on the market and I was going to try a few of them anyway...
@ Njue,
It is tirival to transform an object graph to a dataset.
Ayende, could you summarize the trivial operations involved? I, too, would like to know how you transformed your object graph to a dataset and wired it up to MSRS.
Winston,
see next post about it.
Can you email me some more information about both how you used (or would prefer to use) NHibernate with reporting and also specifically what problems you have with RTL in RS. We've just released a public beta of Data Dynamics Reports which, among other things will read RDL files, and does support RTL (although I thought RS did too). I'm interested to know what features we might be able to add to help make using NHibernate, RTL more useful in reporting. I'd add XPath to that list, but I think it's hopeless <grin> :)
Scott Willeke
Data Dynamics
http://www.datadynamics.com/
Hi Ayende!
I
m using HN in my project and I think NHibernate isn
t appropriate for complex reporting or may be my knowledges are not enough for this stuff.Could you recommended me any information for using NH for reporting and any tips& tricks would be very useful!!!
Thanks!!
Normally,I wouldn't use NHibernate for reports, SQL is usually better at this sort of thing.
The scenario that I was facing is a legacy database schema that I have already mapped to NHibernate and reports that contained business logic.
Therefor, I choose to do reporting via the business layer.
Normally, I would suggest reports to use SQL directly.
That said, Hibernate in Action has a section on reporting queries, and I thinks the docs as well.
Hi Ayende,
I am currently struggling with how to handle retrieving data in large sets (~10,000 records) while still working within the DDD approach I have started. I have been studying your approach using repositories and I am working on implementing a set of specific repositories for things in my system. One is a StudentRepository which is responsible for managing the students in our system. Most of the repository methods are like Save, Remove, Get, Find, etc. These all use NHibernate to do their work. How would you go about implementing a requirement of "Retrieve students matching some criteria and save results to a downloadable Excel file" where the results could be upwards of ten thousand records? Would this be the responsibility of the repository or some other service? I am just looking for some advice or suggestions.
Thanks!
Comment preview