关于spring+hibernate的update方法的问题!
我有一个表
<hibernate-mapping>
<class name= "com.pojo.fileClass " table= "fileclass " schema= "dbo " catalog= "LUCKYGLD ">
<id name= "code " type= "java.lang.String ">
<column name= "code " length= "12 " />
<generator class= "assigned " />
</id>
<property name= "name " type= "java.lang.String ">
<column name= "name " length= "50 " not-null= "true " />
</property>
<property name= "layer " type= "java.lang.Integer ">
<column name= "layer " not-null= "true " />
</property>
<property name= "isend " type= "java.lang.Integer ">
<column name= "isend " not-null= "true " />
</property>
<property name= "memo " type= "java.lang.String ">
<column name= "memo " />
</property>
</class>
</hibernate-mapping>
提交表单提交的数据包扩code、name、memo都是string类型。
FileClass fileClass=(FileClass)getHibernateTemplate()
.get( "com.pojo.FileClass ", code);
fileClass.setCode(code);
fileClass.setName(name);
fileClass.setMemo(memo);
getHibernateTemplate().update(fileClass);
如果我没有修改code的值就正常,如果我修改了code的值则提示出错。
javax.servlet.ServletException:
org.springframework.orm.hibernate3.HibernateSystemException: Unexpected row count: 0 expected: 1; nested exception is
org.hibernate.HibernateException: Unexpected row count: 0 expected: 1
------解决方案--------------------晕,cod