user3244392
user3244392

Reputation: 45

Possible issues in NHibernate CreateSQLQuery

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

Answers (1)

Liath
Liath

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

Related Questions