问答详情
源自:1-11 通过Hibernate API编写访问数据库的代码

junit测试出错org.hibernate.MappingException: Unknown entity: com.entity.Student

六月 28, 2016 8:00:54 下午 org.hibernate.Version logVersion

INFO: HHH000412: Hibernate Core {5.2.0.Final}

六月 28, 2016 8:00:54 下午 org.hibernate.cfg.Environment <clinit>

INFO: HHH000206: hibernate.properties not found

六月 28, 2016 8:00:54 下午 org.hibernate.cfg.Environment buildBytecodeProvider

INFO: HHH000021: Bytecode provider name : javassist

六月 28, 2016 8:00:54 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity

WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.

六月 28, 2016 8:00:54 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>

INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}

六月 28, 2016 8:00:54 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)

六月 28, 2016 8:00:54 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernate]

六月 28, 2016 8:00:54 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001001: Connection properties: {user=root, password=****}

六月 28, 2016 8:00:54 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001003: Autocommit mode: false

六月 28, 2016 8:00:54 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>

INFO: HHH000115: Hibernate connection pool size: 20 (min=1)

六月 28, 2016 8:00:55 下午 org.hibernate.dialect.Dialect <init>

INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect

六月 28, 2016 8:00:55 下午 org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources

INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@6e2aa843'

六月 28, 2016 8:00:55 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop

INFO: HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/hibernate]


提问者:云雀 2016-06-28 20:05

个回答

  • Pasunan
    2016-09-10 15:42:41
    已采纳

    新版本的hibernate和旧版的生成sessionfactory的方式不一样

  • 今年三年级啦
    2017-02-28 18:19:23

    // 获得 session工厂

    sessionFactory = new Configuration().configure().buildSessionFactory();

    // 获得 session

    session = sessionFactory.getCurrentSession();

    // 开启事务

    transaction = session.beginTransaction();


  • 慕粉3917970
    2016-09-02 18:06:52

    同学我和你是一样的错误,你现在解决了吗?

  • applelovelo
    2016-06-28 21:48:16

    实体类配置出错 hibernate不识别 检查配置文件 是否类的名称写错 还有getter setter方法是否写错都有可能出错