Java Play Framework 1 hibernate集成

Java Play Framework 1 hibernate集成,java,hibernate,playframework,playframework-1.x,hibernate3,Java,Hibernate,Playframework,Playframework 1.x,Hibernate3,我正在使用Play 1.2.5。我正在我的play项目中使用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="hibe

我正在使用Play 1.2.5。我正在我的play项目中使用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>
com.mysql.jdbc.Driver
密码
jdbc:mysql://localhost:3306/dbname
用户名
org.hibernate.dialogue.mysqldialogue

我的应用程序运行正常,但我不确定在这两个文件中定义db连接是否是一种好的做法。是否有一种方法可以在单个位置定义db连接。如果我错了,请更正。

您不需要Hibernate映射文件。映射是使用模型类上的JPA注释指定的


阅读以开始。

删除hibernate.cfg.xml文件时会发生什么?Play1在内部管理Hibernate,基本上不需要任何额外的配置文件。除此之外,按照手册中的说明去做,而不是按照你自己认为需要做的去做。我试图删除hibernate.cfg.xml文件并运行应用程序。我收到以下错误,原因是:org.hibernate.HibernateException:/hibernate.cfg.xml未找到。如果我删除这个文件,那么我需要在哪里提供映射信息。i、 模型类的e映射