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;
}

相关文章:

  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
猜你喜欢
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-06-10
  • 2022-12-23
相关资源
相似解决方案