hibernate.3.3.8.source-code.hibernate.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- 显示实际操作数据库时的SQL --> <property name="show_sql">true</property> <!-- druid <property name="connection.provider_class">com.alibaba.druid.support.hibernate.DruidConnectionProvider</property> <property name="url">jdbc:mysql://%s</property> <property name="username">root</property> <property name="password">123456789</property> <property name="driverClassName">com.mysql.cj.jdbc.Driver</property> --> <!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 <property name="filters">stat</property> --> <!-- hikaricp --> <property name="connection.provider_class">org.hibernate.hikaricp.internal.HikariCPConnectionProvider</property> <property name="hikari.jdbcUrl">jdbc:mysql://%s?useLocalSessionState=true&characterEncoding=utf8&useSSL=true&verifyServerCertificate=false&serverTimezone=UTC</property> <property name="hikari.username">root</property> <property name="hikari.password">123456789</property> <property name="hikari.driverClassName">com.mysql.cj.jdbc.Driver</property> <!-- 连接参数 <property name="connection.useLocalSessionState">true</property> <property name="connection.characterEncoding">utf8</property> <property name="connection.useSSL">true</property> <property name="connection.verifyServerCertificate">false</property> <property name="connection.serverTimezone">UTC</property> --> <!-- 方言 --> <property name="dialect">org.hibernate.dialect.MySQL8Dialect</property> <!-- 设置hibernate中session与线程绑定 本地事务thread 分布式事务jta--> <property name="hibernate.current_session_context_class">thread</property> <!-- 自动关闭 = --> <property name="hibernate.transaction.auto_close_session">true</property> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize">10</property> <property name="minIdle">10</property> <property name="maxActive">100</property> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait">60000</property> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis">60000</property> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis">300000</property> <property name="validationQuery">SELECT 1</property> <property name="testWhileIdle">true</property> <property name="testOnBorrow">false</property> <property name="testOnReturn">false</property> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 --> <property name="poolPreparedStatements">true</property> <property name="maxPoolPreparedStatementPerConnectionSize">20</property> <!-- 自动创建表 --> <property name="hibernate.hbm2ddl.auto">update</property> </session-factory> </hibernate-configuration>