gpt4 book ai didi

java - 从数据库创建 Hibernate 映射文件和 PJOS 时出错

转载 作者:行者123 更新时间:2023-11-29 04:38:59 26 4
gpt4 key购买 nike

我使用 java 版本 8.0.2 和 Mysql Gui 9:02 软件。我尝试从数据库创建 Hibernate 映射文件和 PJOS,但我总是收到以下错误消息

Hibernate 配置失败并显示消息:
无法从数据库中获取建议的身份策略列表。可能是 JDBC 驱动程序问题。
有关异常详细信息,请参阅 message.log。

hibernate .cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mind_1.0.2?zeroDateTimeBehavior=convertToNull</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
</session-factory>
</hibernate-configuration>

请帮帮我!

enter image description here

最佳答案

我想你错过了数据库密码标签。

<property name="hibernate.connection.password">admin</property>
 <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">admin</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/DBname
</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect
</property>
<property name="show_sql">false</property>
<property name="hbm2ddl.auto">update</property>

关于java - 从数据库创建 Hibernate 映射文件和 PJOS 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33889038/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com