我刚开始使用 Hibernate,我一直在尝试将它与 H2 连接起来。
我的 hibernate.cfg.xml 文件如下所示:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">org.h2.Driver</property>
<property name="connection.driver_class">jdbc:h2:mem:test</property>
<property name="connection.username">sa</property>
<property name="connection.password"/>
<!-- DB schema will be updated if needed -->
<!-- <property name="hbm2ddl.auto">update</property> -->
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
</session-factory>
</hibernate-configuration>
我收到一条错误消息:Cannot resolve class 'jdbc'
. 我用 Maven 安装了 H2。