不同包下有两个相同名称的实体类,并且都带有@Entity注解,启动时就会报以下错误::
Caused by: org.springframework.dao.DataAccessResourceFailureException: Could not create JPA EntityManager; nested exception is org.hibernate.DuplicateMappingException: The [xxx.xx.xx.xxxxx] and [xxx.xx.xx.xxxxx] entities share the same JPA entity name: [xxxxx] which is not allowed!
Caused by: org.hibernate.DuplicateMappingException: The [xxx.xx.xxxxx] and [xxx.xx.xx.xxxxx] entities share the same JPA entity name: [xxxxx] which is not allowed!
解决方法::
@Entity有个name属性
修改:
@Entity(name="xxx")添加name属性
例如: