Hibernate配置druid

1 druid版本0.2.13或以上

2 hibernate核心包有org.hibernate.service.jdbc.connections.spi.ConnectionProvider;

我使用的是4.2

参考配置

<session-factory>
        <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
  <property name="hibernate.connection.provider_class">

com.alibaba.druid.support.hibernate.DruidConnectionProvider</property>
  <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/hibernate</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.connection.password">admin</property>
  <property name="hibernate.connection.driverClassName">com.mysql.jdbc.Driver</property>
  <property name="hibernate.show_sql">true</property>
  <property name="hibernate.current_session_context_class">thread</property>
  <property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
     <property name="hibernate.format_sql">true</property>
 </session-factory>

 

你可能感兴趣的:(Hibernate,druid)