求助!hibernate多对一问题
我只是配置了 多 的代码
配置文件如下:
<class name= "com.uchr.domain.hibernate.LevelSalaryValue " table= "levelSalaryValue " schema= "dbo " catalog= "uchr ">
<id name= "lsvId " type= "java.lang.Integer ">
<column name= "lsvId " />
<generator class= "native " />
</id>
<property name= "levelId " type= "java.lang.Integer ">
<column name= "levelId " />
</property>
<property name= "levelSalarys " type= "java.lang.Double ">
<column name= "levelSalarys " scale= "4 " />
</property>
<many-to-one name= "levelSalary "
column= "levelSalaryId "
class= "com.uchr.domain.hibernate.LevelSalary "
cascade= "none " lazy= "false "/>
</class>
public class LevelSalaryValue extends Entity implements java.io.Serializable {
// Fields
private Integer lsvId;
private Integer levelId;
private Integer levelSalaryId;
private Double levelSalarys;
private LevelSalary levelSalary = new LevelSalary();
// Constructors
省略set get方法
}
使用写入操作的时候就报错
org.springframework.dao.InvalidDataAccessApiUsageException: com.uchr.domain.hibernate.LevelSalary; nested exception is
org.hibernate.TransientObjectException: com.uchr.domain.hibernate.LevelSalary
LevelSalary 使我配置 一 的文件
帮忙解决一下,谢谢!!!
------解决方案--------------------把以下这两句删了试试:(你的配置文件里面都没这两样)
private Integer levelSalaryId;
private Double levelSalarys;
那个extends Entity什么东西,没用的也删了.
估计就行了