hibernate核心配置
This commit is contained in:
parent
30b978b4d4
commit
fe78942add
51
src/main/resources/hibernate.cfg.xml
Normal file
51
src/main/resources/hibernate.cfg.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?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>
|
||||
<!-- 连接数据库的基本参数 -->
|
||||
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
|
||||
<property name="hibernate.connection.url">jdbc:sqlserver://152.136.182.168:1433;\
|
||||
databaseName=Elm;\
|
||||
encrypt=true;\
|
||||
trustServerCertificate=true;\
|
||||
loginTimeout=30;
|
||||
</property>
|
||||
<property name="hibernate.connection.username">myh</property>
|
||||
<property name="hibernate.connection.password">20231103#MS_Sql</property>
|
||||
<!-- 配置Hibernate的方言 -->
|
||||
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
|
||||
|
||||
<!-- 可选配置================ -->
|
||||
<!-- 打印SQL -->
|
||||
<property name="hibernate.show_sql">true</property>
|
||||
<!-- 格式化SQL -->
|
||||
<property name="hibernate.format_sql">true</property>
|
||||
<!-- 自动创建表 -->
|
||||
<property name="hibernate.hbm2ddl.auto">update</property>
|
||||
|
||||
<!-- <!– 配置C3P0连接池 –>-->
|
||||
<!-- <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>-->
|
||||
<!-- <!–在连接池中可用的数据库连接的最少数目 –>-->
|
||||
<!-- <property name="c3p0.min_size">5</property>-->
|
||||
<!-- <!–在连接池中所有数据库连接的最大数目 –>-->
|
||||
<!-- <property name="c3p0.max_size">20</property>-->
|
||||
<!-- <!–设定数据库连接的过期时间,以秒为单位,-->
|
||||
<!-- 如果连接池中的某个数据库连接处于空闲状态的时间超过了timeout时间,就会从连接池中清除 –>-->
|
||||
<!-- <property name="c3p0.timeout">120</property>-->
|
||||
<!-- <!–每3000秒检查所有连接池中的空闲连接 以秒为单位–>-->
|
||||
<!-- <property name="c3p0.idle_test_period">3000</property>-->
|
||||
|
||||
<!-- <!– 设置事务隔离级别 –>-->
|
||||
<!-- <property name="hibernate.connection.isolation">4</property>-->
|
||||
<!-- <!– 配置当前线程绑定的Session –>-->
|
||||
<!-- <property name="hibernate.current_session_context_class">thread</property>-->
|
||||
|
||||
<!-- 引入映射 -->
|
||||
<!-- <mapping resource="com/itheima/hibernate/domain/Customer.hbm.xml"/>
|
||||
<mapping resource="com/itheima/hibernate/domain/LinkMan.hbm.xml"/> -->
|
||||
<!-- <mapping resource="./"/>-->
|
||||
<!-- <mapping resource="./"/>-->
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
Loading…
Reference in New Issue
Block a user