【发布时间】:2013-06-24 12:06:51
【问题描述】:
下面是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.DerbyDialect</property>
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="hibernate.connection.url">jdbc:derby://localhost:1527/XE</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
</session-factory>
</hibernate-configuration>
我想知道是否总是需要在每个 Hibernate 应用程序中使用 hibernate.cfg.xml,或者是否有其他配置 Hibernate 的方法。
【问题讨论】:
-
那个文件有什么问题?
-
这个文件没有问题,但我想知道是否有任何替代方法来配置 Hibernate。
-
如果你想知道没关系,但是,最好使用xml文件。哪个是最好的。
标签: java spring hibernate spring-mvc