【问题标题】:Intellij Jpa console db schemaIntellij Jpa 控制台数据库架构
【发布时间】:2019-07-19 10:53:35
【问题描述】:

当我想在 Intellij JPA 控制台中进行查询时,我收到relation "topic" does not exist 的错误。 jpql查询select t from Topic t。我正在使用spring boot,我将jpa添加到模块中,持久性工具栏运行良好,但jpa控制台没有。我的想法是 JPA 控制台在正确的数据库模式中找不到,但数据源选择了正确的。

JPA 控制台打印: [2019-07-19 12:49:59] [42P01] 错误:关系“主题”不存在 [2019-07-19 12:49:59] 职位:60

【问题讨论】:

  • 显然您的数据库中没有名为topic 的表。你需要先创建一个
  • 但在数据库中也可以在数据库工具栏中看到:/
  • 也许你在创建它时引用了它? "Topic"topic 不同的表名
  • orm 自动制作的表格
  • 添加更多细节:什么是数据库,如何定义映射?您可以从代码中运行相同的查询吗?检查例如stackoverflow.com/questions/30626989/…

标签: postgresql spring-boot intellij-idea spring-data-jpa


【解决方案1】:

你做了所有这些步骤吗?:

(IDEA版本为2019.1)

【讨论】:

  • 非常漂亮的动画,我已经按照你展示的那样设置好了,但是如果我尝试休眠控制台,它会以异常结束:[2019-07-20 23:11:30] org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 0 and column 0 in FILE C:\Users\ondra\.IntelliJIdea2019.1\system\compiler\agent-chat.87f53839\.generated\Jpa_Console\agent-chat.main-hibernate-1563657080743.cfg.xml. Message: null [2019-07-20 23:11:30] javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
  • @AndrewSneck 也许它与JAXB-API and Java version问题有关?
  • 我添加了这个依赖项:implementation "javax.xml.bind:jaxb-api:2.2.11" implementation "com.sun.xml.bind:jaxb-core:2.2.11" implementation "com.sun.xml.bind:jaxb-impl:2.2.11" implementation "javax.activation:activation:1.1.1" 和休眠控制台现在显示与 jpa 控制台相同的错误:错误:关系“主题”不存在
【解决方案2】:

我在连接数据库时发现了错误。我有字段数据库值postgres,我替换为chatapp - 它是正确的模式,现在它运行良好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-13
    • 1970-01-01
    • 2017-12-09
    • 2021-07-27
    • 1970-01-01
    • 2020-04-12
    • 2017-09-18
    • 1970-01-01
    相关资源
    最近更新 更多