Hibernate创建sessionFactory null

2019-03-25 13:32|来源: 网路

请问各位:
    我在使用junit进行单元测试的时候,到实例化SessionFactory的时候不成功,控制台打印的信息如下:
2013-8-14 15:36:45 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2013-8-14 15:36:45 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.9.Final}
2013-8-14 15:36:45 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
2013-8-14 15:36:45 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2013-8-14 15:36:45 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/hanqi/po/TempPrice.hbm.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/hanqi/po/Product.hbm.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/hanqi/po/CurrentPrice.hbm.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/hanqi/po/LookupCode.hbm.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/hanqi/po/LookupType.hbm.xml
2013-8-14 15:36:45 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null

我检查过我的hibernate.cfg.xml文件和未发现错误。如下:
<hibernate-configuration>
<session-factory>

        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
        <property name="connection.username">POSMAN</property>
        <property name="connection.password">POSMAN</property>
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
       
        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

<mapping  resource="com/hanqi/po/TempPrice.hbm.xml"/>
<mapping  resource="com/hanqi/po/Product.hbm.xml"/>
<mapping  resource="com/hanqi/po/CurrentPrice.hbm.xml"/>
<mapping  resource="com/hanqi/po/LookupCode.hbm.xml"/>
<mapping  resource="com/hanqi/po/LookupType.hbm.xml"/>
</session-factory>
</hibernate-configuration>

xxx.hbm.xml文件我也检查过未发现问题,请问会是在哪个地方出的错。

感谢!

相关问答

更多