META-INF.persistence.xml Maven / Gradle / Ivy
The newest version!
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="bigdog" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> <!-- please put :myconf.properties in your classpath,and give those three variables into the file as three lines <property name="javax.persistence.jdbc.url" value="jdbc:mysql://db.hadoopz.com:3306/bigdog?useUnicode=true&characterEncoding=UTF-8"/> <property name="javax.persistence.jdbc.user" value="root"/> <property name="javax.persistence.jdbc.password" value="ddos"/> --> <property name="hibernate.cache.use_query_cache" value="false"/> <property name="hibernate.cache.use_second_level_cache" value="true"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/> <!-- 最小连接数 --> <property name="c3p0.min_size" value="5"/> <!-- 最大连接数 --> <property name="c3p0.max_size" value="30"/> <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="c3p0.maxIdleTime" value="60"/> <!-- 获得连接的超时时间,如果超过这个时间,会抛出异常,单位毫秒 --> <property name="c3p0.timeout" value="1800"/> <!-- 最大的PreparedStatement的数量 --> <property name="c3p0.max_statements" value="50"/> <!-- 每隔120秒检查连接池里的空闲连接 ,单位是秒--> <property name="c3p0.idle_test_period" value="120"/> <!-- 当连接池里面的连接用完的时候,C3P0一下获取的新的连接数 --> <property name="c3p0.acquire_increment" value="1"/> <!-- 是否每次都验证连接是否可用 --> <property name="c3p0.validate" value="false"/> </properties> </persistence-unit> </persistence>