Does anyone understand how to produce a view from hibernate using the outcomes of a criteria query?
We have got a bit of legacy areas of our application which use sights produced through the application for data retrieval and I love to tie the brand new NHibernate stuff into individuals for minimal friction.
I'd transform it into extra time method and so i may ultimately do that:
The present process is much like this:
SQLString = _bstr_t("SELECT name FROM User WHERE Retired = false"); ...run the query process the results, then... SQLStringView = _bstr_t(" \ BEGIN EXECUTE IMMEDIATE 'CREATE OR REPLACE VIEW ") + ViewName + _bstr_t(" AS ") + SQLString;
So once we run this question we obtain a view which has exactly the same data inside it. I can not see how to duplicate this really is hibernate though.
If you are only thinking about blocking the information being came back, you might want to take a look at Nhibernate's blocking systems here is a good article setting out their usage.
Take a look at this article to have an explanation of mapping an entity class to some view along with a table. I am not sure that you will have the ability to dynamically make your sights at runtime while you specified but possibly you can do this included in the schema generation process while using database-object mapping?
To produce a view using NHibernate directly, have a look in the 'database-object' mapping element.
Ayende has an example here.