我想设置'水平'与一些值,但我收到异常。以下是版本和代码。net.sf.hibernate.PropertyValueException:非空属性引用空或瞬态值
Hibernate的版本:2.1
服务器:Weblogic的11克
映射文件:
<property name="Level" type="java.lang.Integer">
<meta attribute="default-value">new java.lang.Integer(0)</meta>
<column name="Level" not-null="true" length="3" />
</property>
代码:
public Pol fillPol(ResultSet rs) throws SQLException {
Pol p = new Pol();
p.setLevel(new Integer(rs.getInt("setLevel")));
if (rs.IsNull()) {
p.setLevel(null);
}
return p;
}
例外,我得到
Caused by: net.sf.hibernate.PropertyValueException: not-null property references a null or transient value
请帮忙。
还有你的代码无关与Hibernate。您在问题中使用简单的ResultSet。 – WeMakeSoftware 2014-10-28 08:37:47