Reputation: 45
Are there restrictions/problems when using CreateSQLQuery? Should we avoid using CreateSQLQuery, or is it okay to use it in some special cases? What happens with the hibernate -cache, I think hibernate doesn't get this kind of changes?
Upvotes: 1
Views: 320
Reputation: 10191
You should really use CreateSQLQuery as a last resort as it bypasses most the functionality NHibernate provides. It's effectively an ADO.NET call in the middle of your ORM system.
In addition you lose the benefit of NHibernate generating your SQL (and so making it database independent).
If possible try creating a HQL query instead.
Upvotes: 1