【问题标题】:Spring Boot + Hibernate: @Entity name ignoredSpring Boot + Hibernate:@Entity 名称被忽略
【发布时间】:2018-02-25 02:34:47
【问题描述】:

我们有一个使用 Spring Boot + JPA/Hibernate 构建的服务。

我在不同的 jars/packages 中有两个同名的类。

使用 Eclipse 运行应用程序会导致 重复导入 问题,因此我在其中一个实体中添加了以下内容:

@Entity(name = "EnderecoCEP")

它解决了 Eclipse 中的问题,我可以很好地运行应用程序。但是,当使用 java -jar 运行 Spring Boot 生成的 jar 时,问题又回来了:

Caused by: org.hibernate.DuplicateMappingException: duplicate import: Endereco refers to both b.c.c.c.e.Endereco and b.c.c.d.e.Endereco (try using auto-import="false")

看起来@Entity(name) 属性被完全忽略了。我发现很多帖子抱怨类似问题(另一个 JAR 映射),但没有一个真正的解决方案。

【问题讨论】:

    标签: hibernate jpa spring-boot spring-data-jpa


    【解决方案1】:

    请忽略这个问题!

    问题出在我的 POM 中的 JAR 版本上! 4小时后!!!

    【讨论】:

      猜你喜欢
      • 2020-03-12
      • 2014-10-06
      • 2023-03-21
      • 2017-06-14
      • 2021-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-13
      相关资源
      最近更新 更多