首页 新闻 赞助 找找看

nhibernate 中 报 Could not execute query[SQL: SQL not available] 错误

0
悬赏园豆:10 [已解决问题] 解决于 2011-03-29 13:10

private static ISession _session ;
public IList<int> list()
{
using (_session = factory.Session)
{
IQuery querys
= _session.CreateQuery(“select id from news”);
return querys.List<int>();

}
}


private static ISessionFactory _factory;
static object obj = new object();
public ISession Session
{
get
{
if (_factory == null)
{
lock (obj)
{
if (_factory == null)
{
Configuration cf
= new Configuration().Configure();
_factory
= cf.BuildSessionFactory();
}
}
}
return _factory.OpenSession();
}
}
为什么这么写调用 list() 总会报错。报的是

Could not execute query[SQL: SQL not available]    在return querys.List<int>(); 中报的,本人是nhibernate新手,请指教下。

二锅头的主页 二锅头 | 初学一级 | 园豆:167
提问于:2011-03-29 09:40
< >
分享
最佳答案
1

看innerException...

收获园豆:10
李永京 | 老鸟四级 |园豆:3114 | 2011-03-29 09:58
额谢谢,配置文件中我将id 错误设置成了int64,改成int32就好了谢谢!
二锅头 | 园豆:167 (初学一级) | 2011-03-29 13:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册