关于datetime类型使用:
Oracle: "and tb.EffectiveDate >= to_date(?,'yyyy-mm')"
Sql: "and tb.EffectiveDate >= Date(?,'yyyy-mm-dd')"
Postgre: "and tb.EffectiveDate >= date(?)"
在Nhibernate中查询SqlServer
ISQLQuery sqlQuery = Session.CreateSQLQuery("SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE c.MOTHER_ID = c.ID") .AddEntity("cat", typeof(Cat)) .AddEntity("mother", typeof(Cat));
var tempList = sqlQuery.List<object[]>();
在此sql语句用不能使用对象关系映射,需直接使用sql表名、列名.