2010-12-22 74 views
0

嗨,我使用Spring-Hibernate與HibernateDaoSupport,其中我的Dao延伸了HibernateDaoSupport。當我從表中獲取數據時,出現以下錯誤:當我在同一張表上提交數據時,它運行成功。可以任何人提供您的想法嗎?org.springframework.orm.hibernate3.HibernateSystemException:...爲什麼它是?

錯誤:

org.springframework.orm.hibernate3.HibernateSystemException: Null value was assigned to a property of primitive type setter of com.mypack.table.TblValues.minval; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.mypack.table.TblValues.minval

注:minval是在表TblValues列的一個,以及i分配空值。

碼錶POJO吸氣劑& setter屬性:

@Column(name="minVal",nullable=true) 
    public byte getMinVal() { 
     return this.minVal; 
    } 
public void setMinVal(byte minVal) { 
     this.minVal = minVal; 
    } 

回答

4

你不能有一個nullable原始類型,這是一個矛盾(在Java中,至少)。

如果您希望minVal爲空,則需要使用Byte java類型,而不是byte

+0

我自己並沒有採取字節數據類型,我使用自動生成的NetBeans中的逆向工程 – Naresh 2010-12-22 10:42:40

相關問題