Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未找到使用批注和获取hibernate.cfg.xml文件_Hibernate - Fatal编程技术网

未找到使用批注和获取hibernate.cfg.xml文件

未找到使用批注和获取hibernate.cfg.xml文件,hibernate,Hibernate,我在实体类中使用hibernate注释,因此我没有使用hibernate.cfg.xml文件,但在我尝试生成响应时,它抛出了org.hibernate.hibernateeexception:/hibernate.cfg.xml not found exception。有什么建议吗?我想这些问题只是对hibernate基本知识的误解。当您使用Spring Hibernate时,您需要在您的项目中添加一个基本的Hibernate.cfg.xml,在其中添加Hibernate ORM连接参数。 这是

我在实体类中使用hibernate注释,因此我没有使用hibernate.cfg.xml文件,但在我尝试生成响应时,它抛出了org.hibernate.hibernateeexception:/hibernate.cfg.xml not found exception。有什么建议吗?

我想这些问题只是对hibernate基本知识的误解。当您使用Spring Hibernate时,您需要在您的项目中添加一个基本的Hibernate.cfg.xml,在其中添加Hibernate ORM连接参数。 这是cfg.xml的一个基本示例:

<?xml version='1.0' encoding='utf-8'?> 
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="connection.url">jdbc:"database/url/ip/"</property>
        <property name="connection.username">"userlog"</property>
        <property name="connection.password">"psw"</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="show_sql">false</property>
        <property name="format_sql">false</property>
        <property name="use_sql_comments">false</property>
        <property name="generate_statistics">false</property>
        <property name="hbm2ddl.auto">validate</property>
        <property name="connection.pool_size">1</property>
        <property name="current_session_context_class">thread</property>
        <!-- Mapping files will go here.... -->
        <mapping resource="xml mapping"/>
        <mapping class="class mapping"/>
    </session-factory>
</hibernate-configuration>

jdbc:“数据库/url/ip/”
“用户日志”
“psw”
com.mysql.jdbc.Driver
org.hibernate.dialogue.mysqldialogue
错误的
错误的
错误的
错误的
验证
1.
线
我希望这是有用的