Java Hibernate驱动程序类配置,指示默认属性和类

Java Hibernate驱动程序类配置,指示默认属性和类,java,hibernate,Java,Hibernate,基本上,我想知道为什么它试图加载org.h2.Driver,即使我没有使用它,并因此抛出错误。 其次,当我指定了一个连接池时,为什么它使用内置连接池 下面是我的配置文件的一个片段 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernat

基本上,我想知道为什么它试图加载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]