当前位置: 代码迷 >> ASP.NET >> nhibernate [could not execute query]错误
  详细解决方案

nhibernate [could not execute query]错误

热度:6068   发布时间:2013-02-25 00:00:00.0
nhibernate [could not execute query]异常求助
[ADOException: could not execute query
[ select job0_.[id] as column1_19_, job0_.[Daiy] as column2_19_, job0_.[Did] as column3_19_, job0_.[Duix] as column4_19_, job0_.[Qix] as column5_19_, job0_.[Rens] as column6_19_, job0_.[Time] as column7_19_, job0_.[Yaoq] as column8_19_ from [Job] job0_ ]
[SQL: select job0_.[id] as column1_19_, job0_.[Daiy] as column2_19_, job0_.[Did] as column3_19_, job0_.[Duix] as column4_19_, job0_.[Qix] as column5_19_, job0_.[Rens] as column6_19_, job0_.[Time] as column7_19_, job0_.[Yaoq] as column8_19_ from [Job] job0_]]
  NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +444


//sql 在数据库查询分析器中可以执行

//实体
using System;
using System.Collections;
using System.Collections.Generic;

namespace Modal.Entities
{
[Serializable]
public class Job
{
private string _daiy;
public virtual string Daiy
{
get{ return _daiy; }
set
{
if (value.Length > 50)
throw new ArgumentOutOfRangeException("Daiy", "该字段最大字符为50个");
_daiy = value;
}
}

private string _did;
public virtual string Did
{
get{ return _did; }
set
{
if (value.Length > 50)
throw new ArgumentOutOfRangeException("Did", "该字段最大字符为50个");
_did = value;
}
}

private string _duix;
public virtual string Duix
{
get{ return _duix; }
set
{
if (value.Length > 50)
throw new ArgumentOutOfRangeException("Duix", "该字段最大字符为50个");
_duix = value;
}
}

private int _id;
public virtual int id
{
get{ return _id; }
set
{
_id = value;
}
}

private string _qix;
public virtual string Qix
{
get{ return _qix; }
set
{
if (value.Length > 50)
throw new ArgumentOutOfRangeException("Qix", "该字段最大字符为50个");
_qix = value;
}
}

private string _rens;
public virtual string Rens
{
get{ return _rens; }
set
{
if (value.Length > 50)
throw new ArgumentOutOfRangeException("Rens", "该字段最大字符为50个");
_rens = value;
}
}

private DateTime _time;
public virtual DateTime Time
{
get{ return _time; }
set
{
_time = value;
}
}

private string _yaoq;
public virtual string Yaoq
{
get{ return _yaoq; }
set
{
_yaoq = value;
}
}

}
}


.
.
.
//mapping
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Modal.Entities.Job,Modal" table="[Job]" lazy="true">
<id name="id" column="[id]" type="int">
<generator class="native" />
</id>
<property type="string" length="50" name="Daiy" column="[Daiy]" />
<property type="string" length="50" name="Did" column="[Did]" />
<property type="string" length="50" name="Duix" column="[Duix]" />
<property type="string" length="50" name="Qix" column="[Qix]" />
<property type="string" length="50" name="Rens" column="[Rens]" />
<property type="DateTime" name="Time" column="[Time]" />
  相关解决方案