简体   繁体   English

NHibernate CreateSQLQuery中的可能问题

[英]Possible issues in NHibernate CreateSQLQuery

Are there restrictions/problems when using CreateSQLQuery? 使用CreateSQLQuery时是否存在限制/问题? Should we avoid using CreateSQLQuery, or is it okay to use it in some special cases? 我们应该避免使用CreateSQLQuery,还是可以在某些特殊情况下使用它? What happens with the hibernate -cache, I think hibernate doesn't get this kind of changes? hibernate -cache会发生什么,我认为hibernate没有得到这种改变?

You should really use CreateSQLQuery as a last resort as it bypasses most the functionality NHibernate provides. 您真的应该将CreateSQLQuery用作最后的选择,因为它会绕过NHibernate提供的大多数功能。 It's effectively an ADO.NET call in the middle of your ORM system. 它实际上是ORM系统中间的ADO.NET调用。

In addition you lose the benefit of NHibernate generating your SQL (and so making it database independent). 此外,您还会失去NHibernate生成SQL的好处(因此使它独立于数据库)。

If possible try creating a HQL query instead. 如果可能,请尝试创建一个HQL查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM