Caused by: org.hibernate.MappingException: Could not determine type for: com.bjsxt.model.Specialty, at table: Student, for columns: [org.hibernate.map

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registerDAOImpl': Injection of resource dependencies failed;

nested exception is org.springframework.beans.factory.BeanCreationException:

Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]:

Invocation of init method failed; nested exception is org.hibernate.MappingException:

Could not determine type for: com.bjsxt.model.Specialty, at table: Student, for columns: [org.hibernate.mapping.Column(specialty)]

@ManyToOne不应该写在seters方法上,要不然就会报上述错误

@ManyToOne
@JoinColumn(name="specialtyId")
public Specialty getSpecialty() {
return specialty;
}

应该写在geters方法上面
@ManyToOne
@JoinColumn(name="specialtyId")
public void setSpecialty(Specialty specialty) {
this.specialty = specialty;
}

posted @ 2013-04-10 14:04  springstudent  阅读(1160)  评论(0编辑  收藏  举报