Quote:
NHibernate is my first experience with creating ADO.net provider independent applications. Unfortunately the reporting tool that I'm using (ActiveReports) doesn't support binding to object collections and so I must use one of those nasty DataSets.
NHibernate is much more than just provider independent. It manages the connection and ado.net provider, writes your SQL for you, caches your queries and data, and lets you use plain objects in a simple manner. In your situation the only different thing you need (it seems) is a DataTable or DataSet rather than a collection of objects.
I understand ActiveReports can use DataReaders, DataTables, DataViews, and DataSets. If you want to use NHibernate but need to give ActiveReports a DataSet, what I suggested works just fine.
Quote:
Yes, but the whole reason I need the DataAdapter in the first place is because I need to pass the results of a POSQ (plain old sql query) to an ActiveReports document.
Is the SQL coming from some other tool or are you writing it yourself? If you are writing it yourself yet want to use NHibernate, use HQL instead.
Quote:
The report is not based on HQL (and I'm assuming HQL is not compatible with SQL either).
I assume the report is based on a need to retrieve data from a database table. HQL fills this need by querying on your mapped objects. Behind the scenes, it creates SQL from your HQL based on the mappings of the objects used in the HQL. So it's not a matter of being compatible, it's a matter of doing the same thing two ways. Rather than:
Code:
SELECT * FROM Employees where LastName = 'Smith';
you can query against the Employee object like this:
Code:
from Employee e where e.LastName = 'Smith'
or even an example using parameters, which creates ado.net parameters behind the scenes:
Code:
IQuery q = mySession.CreateQuery("from Employee e where e.LastName = :lastname");
q.SetString("lastname", "Smith");
return q.List();
So if your app is creating SQL in code, NHibernate allows much more object-oriented query building with HQL, IQuery, and ICriteria.