我正在使用Play 1.2.5。我在我的游戏项目中使用了hibernate。我在application.conf中添加了数据库信息,如下所示
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/dbname
db.user=username
db.pass=password
另外,我在conf文件夹下的hibernate.cfg.xml中添加了数据库信息,如下所示,
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/dbname</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
我的应用程序运行正常,但我不确定在两个文件中定义数据库连接是否是一个好习惯。有没有办法在一个地方定义数据库连接。如果我错了,请纠正我。