在做Spring与JPA集成时,出现问题如下:

Caused by: java.lang.IllegalArgumentException: Not an managed type: class com.entity.****

解决:

1.确保实体类中@Entity使用的是javax.persistence.Entity,@id使用的是javax.persistence.Id。

2.在spring xml配置文件中entityManagerFactory对象类org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean的属性persistenceXmlLocation和属性persistenceUnitName不能同时配置,两个属性中保留一个或都不保留,如下:

相关文章:

  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2021-06-11
  • 2021-11-20
  • 2021-08-08
猜你喜欢
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
相关资源
相似解决方案