Hibernate驱动程序类配置指示默认属性&类

时间:2015-02-12 16:46:33

标签: java hibernate

基本上我想知道为什么它试图加载org.h2.Driver即使我没有使用它并因此也抛出错误。
其次,当我指定连接池时,它会使用内置连接池。

这是我的配置文件的片段

<?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="connection.datasource">jdbc/MobicareDB</property>

        <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>

        <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="current_session_context_class">thread</property>
        <property name="show_sql">true</property>
        <property name="use_sql_comments">true</property>
        <property name="generate_statistics">true</property>

还有一个片段 应用程序部署期间的控制台

Info:   HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
Info:   HHH000412: Hibernate Core {4.3.8.Final}
Info:   HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.h2.Driver, hibernate.service.allow_crawling=false, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.max_fetch_depth=5, hibernate.format_sql=true, hibernate.generate_statistics=true, hibernate.connection.username=sa, hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE, hibernate.bytecode.use_reflection_optimizer=false, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=5}
Info:   HHH000021: Bytecode provider name : javassist
Info:   HHH000043: Configuring from resource: hibernate.cfg.xml
Info:   HHH000040: Configuration resource: hibernate.cfg.xml
WARN:   HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Info:   HHH000041: Configured SessionFactory: null
WARN:   HHH000402: Using Hibernate built-in connection pool (not for production use!)
Severe:   org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.h2.Driver]

0 个答案:

没有答案