【发布时间】:2012-02-24 14:56:34
【问题描述】:
我目前正在尝试完成这个 netbeans + hibernate + JavaSE 教程 (http://netbeans.org/kb/docs/java/hibernate-java-se.html)。一切都很好,但是在创建 hibernate.cfg.xml 之后,当涉及到应该应用逆向工程的部分时,逆向工程向导告诉我一些奇怪的消息:
"The database drivers are not added to the project classpath."
"Go to project properties to add database library.".
这有点奇怪,因为 hibernate.cfg.xml 是由 netbeans 生成的。我用 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/sakila</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">apassword</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
</session-factory>
</hibernate-configuration>
【问题讨论】:
标签: java hibernate netbeans reverse-engineering