Java 冬眠忽略我的方言

Java 冬眠忽略我的方言,java,hibernate,Java,Hibernate,我想将hibernate用于postreSQL,但它不起作用。 我将.xml放在“resources”文件夹中 这是我的hibernate.cfg.xml: <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.s

我想将hibernate用于postreSQL,但它不起作用。 我将.xml放在“resources”文件夹中

这是我的hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/postgres</property>
        <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
        <property name="hibernate.connection.username">postgres</property>
        <property name="hibernate.connection.password">123</property>
        <!-- DB schema will be updated if needed -->
        <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
        <property name="hibernate.hbm2ddl.auto">create</property>
        <mapping class="ru.systemprom.example.testClass"/>

    </session-factory>
</hibernate-configuration>
我认为Hibernate不工作是因为发生了这个错误。 为什么它会忽略我的设置以及如何让它工作


注意:我听说Maven从“resources”文件夹中获取了所有内容,所以我认为问题不是因为它

创建会话工厂的代码是什么?确保您正在向其传递配置文件。。。 configure()可以接受字符串、文档、文件、url等

new Configuration().configure("hibernate.cfg.xml")
new Configuration().configure("hibernate.cfg.xml")