带有 persistence.xml 的 Intellij JPA 控制台

2023-12-19

我正在使用 Intellij 13+ 设置无 xml 持久性 JPA/Hibernate 4+/Spring 3+。当我尝试在 jpa 控制台中执行查询时,出现以下错误:

javax.persistence.PersistenceException: Unable to build entity manager factory
java.lang.RuntimeException: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.PostgreSQL9Dialectt.PostgreSQL9Dialect] as strategy [org.hibernate.dialect.Dialect]

使用默认的 postgres 方言,我得到同样的错误。 知道发生了什么事吗?

配置摘录:

<bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="com.wikiz.service.model.rep" />
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
    </property>
    <property name="jpaProperties">
        <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
            <prop key="jadira.usertype.autoRegisterUserTypes">true</prop>
            <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
        </props>
    </property>
</bean>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${db.driver}"/>
    <property name="url" value="${db.url}"/>
    <property name="username" value="${db.user}"/>
    <property name="password" value="${db.pass}"/>
</bean>

和变量:

hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.hbm2ddl.auto=create

Ok here it is. I am not 100% sure if this helps your case but I think this is what you need to do: Add a jdbc connection to your database from the database tab (usually to your right) Add a jdbc connection to your database


Then add the hibernate facet to your module Go to modules (alt+ctrl+shift+s) then add it: enter image description here
Now you have enabled the persistance tab on your left (usually) and you can assign a datasource to your

Now add the hibernate configuration but you have to add the xml file of hibernate. I haven't tried it with just adding the spring application context instead of hibernate.cfg.xml. Maybe it will work...
enter image description here


Now you have enable the presistance configuration for intellij and you can assign a datasource to it.
enter image description here
Select that datasource that you want and you will be able to use the JPA console with your jpa POJOs and HSQLs
enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

带有 persistence.xml 的 Intellij JPA 控制台 的相关文章

随机推荐

  • phpmyadmin 导出 html 而不是 sql

    我有 phpmyadmin 4 4 7 并且之前已将 MySql 表精细导出为 sql 格式 但是 即使我使用快速或高级方法选择 sql 格式 它现在仍以 html 格式导出 非常感谢任何想法 建议 谢谢 Lyle 当数据库非常大 在我的例
  • 最优雅的项目分类用户界面?

    我有一个项目集合 用户需要以多种方式对这些项目进行分组 分类 举个例子 假设它是汽车的集合 用户希望按以下方式对它们进行分类 颜色 红 银 蓝 黑等 车身形状 掀背车 轿车 轿跑车 旅行车等 座位 2 4 5 6 等 etc 您是否遇到过一
  • 使用 DI 进行类注入有什么意义吗

    在 Angular1 中 我们经常使用工厂来注入类 而不是实例 在 angular2 中 我可以做同样的事情 provide MyClass useFactory gt return MyClass constructor MyClass
  • 多个 PostConstruct 方法?

    它说在Java 的文档 http docs oracle com javaee 7 api javax annotation PostConstruct htmlPostConstruct 页面 该注解只能注解一种方法 但我只是尝试使用 P
  • AVL树最小节点

    高度为 h 的 AVL 树中的最小节点数是多少 我在互联网上做了一些研究 但它们都很令人困惑 n h 是高度为 h 的 AVL 树的最小节点数 则 n 0 1 n 1 2 n h 1 n h 1 n h 2
  • sas 日期时间转 R 日期格式

    我有一个包含日期时间变量的 SAS 数据集 我已使用 sas7bdat 包将此数据集移植到 R 中 但日期时间变量以整数格式显示 例如 1706835972 有什么办法可以将这个整数转换为日期格式吗 要准确匹配默认日期时间结构的 SAS 输
  • reinterpret_cast 为相同类型

    考虑以下程序 struct A int main A a A b a A c reinterpret cast a a 编译器 g 14 抛出一个错误invalid cast from type A to type A 为什么转换为相同类型
  • “请求中的 URI 无效”尝试代理 iframe 内容以进行本地调试

    我正在尝试调试包含 iframe 的页面中的问题 为父页面提供服务的网站是我正在处理的代码 我可以轻松地在本地运行 但 iframe 的内容来自我无权访问的代码 有一些保护措施会阻止跨域 iframe 这在生产中不会成为问题 因为它们将在同
  • 如何在Linux上后台无限运行脚本?

    我有一个带有无限循环的 PHP 脚本 我需要这个脚本永远运行 所以 我跑 php path to script php gt dev null 它在我当前用户的安全上下文中在后台运行 但是当我关闭终端窗口 注销 时 CentOS Linux
  • 从命令行运行 PyCharm 项目

    我正在尝试将我的项目部署到服务器并在那里运行它 当我尝试从命令行启动脚本时 它显示错误 导入父目录中的脚本时 我使用 PyCharm 制作了该项目 python 2 7 10 并将其分散到多个目录中 这些文件夹看起来像这样 项目 dir s
  • 匹配澳大利亚商业号码 (ABN) 的正则表达式

    我需要一个正则表达式来匹配一个值 其中每个字符可以是 0 到 9 之间的数字或空格 该值必须恰好包含 11 位数字 例如 它应匹配格式为 012 345 678 90 或 01234567890 的值 有人可以帮我解决这个问题吗 为了将来可
  • Camunda 使用 REST 获取 XOR 网关的机会

    I have the following situation 我想要做的是在我的 Angular 应用程序中获得一个下拉菜单 其中列出了书籍的所有机会 所以我可以在 哈利 波特 白鲸记 和 鲁宾逊漂流记 之间进行选择 当我选择一本书并按提交
  • 沙盒 AppDomain 中的线程安全

    我有一个应用程序域来托管不受信任的代码 程序集 我用安全属性解决了所有安全问题 效果很好 不受信任的代码在专用线程上运行 CLR 是 2 0 这就是我所拥有的应用程序域Shell http code google com p robocod
  • 在实践中(而非理论上),小批量与实时流有什么区别?

    在实践中 而非理论上 小批量与实时流有什么区别 从理论上讲 我理解迷你批次是在给定时间范围内进行批处理的东西 而实时流更像是在数据到达时执行某些操作 但我最大的问题是为什么不使用带有 epsilon 时间范围 例如一毫秒 的迷你批次或者我想
  • 为什么 Firefox 即使输入不同的名称也会自动完成?

    或者 Firefox 如何确定密码 用户名的去向 如果我更改输入元素的名称 id 标题 类 Firefox 会继续用密码或电子邮件填充它 如果我正确理解 Firefox 的源代码 浏览器首先会在表单中查找密码字段 如果表单包含超过 3 个密
  • 使用 Dropout 时的验证损失

    我试图了解辍学对验证平均绝对误差 非线性回归问题 的影响 无辍学 辍学率为 0 05 With dropout of 0 075 在没有任何 dropout 的情况下 验证损失大于训练损失 如下所示1 https i stack imgur
  • 如何解压缩特定文件夹?

    如何使用 Ant 解压缩特定文件夹 具体来说 我下载了 apache tomcat 6 0 29 zip 其中包含文件夹 apache tomcat 6 0 29 我希望 Ant 解压 apache tomcat 6 0 29 下的所有内容
  • Gitlab CI部署AWS EC2

    我们有一个 lumen 应用程序 我们将项目移动到 GitLab 如果一切正常 我们想拉取该项目 我们添加两个脚本 gitlab ci yml variables All or variables stages test productio
  • airflow postgresql 后端:(psycopg2.OperationalError)致命:用户“airflow”的身份验证失败

    尝试在centos7机器上使用postgresql作为airflow v1 10 5 的后端 在本文之后 https www ryanmerlin com 2019 07 apache airflow installation on ubu
  • 带有 persistence.xml 的 Intellij JPA 控制台

    我正在使用 Intellij 13 设置无 xml 持久性 JPA Hibernate 4 Spring 3 当我尝试在 jpa 控制台中执行查询时 出现以下错误 javax persistence PersistenceException