【发布时间】:2015-03-18 07:59:02
【问题描述】:
我是 h2 数据库的新手。我使用浏览器控制台在 h2 中创建了一些表。 当我尝试创建它创建的 hibernate.cfg 文件时,如下所示。
<?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.connection.driver_class">org.h2.Driver</property>
<property name="hibernate.connection.url">jdbc:h2:~/selva</property>
</session-factory>
</hibernate-configuration>
但是当我尝试创建逆向工程时,出现以下错误。
为什么会这样?.Netbeans 为 mysql 和 mssql 数据库创建反向工程文件。但为什么不创建 h2?
Cannot establish database connection with selected Hibernate Configuration file. Please verify the database connection details in hibernate.cfg.xml.
1.How to solve the above issue?
2.Is Querying inmemory database in hibernate is different from the persistent database?
2.Is Configuring inmemory database in hibernate is different from the persistent database?
任何帮助将不胜感激!!!
【问题讨论】:
-
您是否缺少(至少)连接的用户名?
-
@Joachim,我在不使用适合我的休眠模式的情况下执行查询。但我无法在休眠模式中执行该操作
-
快速浏览一下官方网站(h2database.com/html/cheatSheet.html):如果你指定方言是否有效:
org.hibernate.dialect.H2Dialect ? -
@Joachim,不工作。感谢您的建议
标签: java mysql netbeans h2 hibernate3