Hibernate 5: - org.hibernate.MappingException:未知实体

Hibernate 5: - org.hibernate.MappingException:未知实体

org.hibernate.MappingException: Unknown entity当我尝试将hibernate 5.0与mysql集成时,我收到错误消息

这似乎是hibernate5.0.0和5.0.1的问题。这适用于hibernate 4.3.9

Maven依赖

<dependency>
    <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.0.0.Final</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.36</version></dependency>

的hibernate.cfg.xml


<session-factory>
    <!-- Database connection settings -->
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url">jdbc:mysql://localhost:3307/SampleDB
    </property>
    <property name="connection.username">root</property>
    <property name="connection.password"></property>
    <!-- JDBC connection pool (use the built-in) -->
    <property name="connection.pool_size">1</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>
    <!-- Drop and re-create the database schema on startup -->
    <property name="hbm2ddl.auto">create</property>
    <mapping class="UserA.User"></mapping></session-factory>



拉丁的传说
浏览 619回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
MySQL