Spring 3.1.1 + Struts 2.3.1.2 + Hibernate 4.1 整合(SSH)(五)

2014-11-24 07:23:29 · 作者: · 浏览: 7
配置文件(struts.properties):

[html]
struts.devMode=true
struts.action.extension=action
struts.objectFactory = spring
struts.objectFactory.spring.autoWire = name
struts.objectFactory.spring.useClassCache = true
struts.objectFactory.spring.autoWire.alwaysRespect = true
struts.configuration.xml.reload=true
struts.i18n.encoding = utf-8
struts.tag.altSyntax=true
struts.custom.i18n.resources=Eriloan_Text
struts.locale=zh_CN
struts.ui.theme = simple
struts.ognl.allowStaticMethodAccess=true
struts.multipart.maxSize=10000000000
#struts2.sslplugin.httpPort=8080
#struts2.sslplugin.httpsPort=8443
#struts2.sslplugin.annotations=true
#struts.multipart.parser=cos
#struts.multipart.parser=pell
struts.multipart.parser=jakarta
struts.multipart.saveDir=tempUpload

数据库配置文件:

[html]
#MySQL配置
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
#hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
#hibernate.dialect=org.hibernate.dialect.MySQLDialect
jdbcjdbc.url=jdbc:mysql://localhost:3306/test useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.driver=com.mysql.jdbc.Driver
jdbc.username=root
jdbc.password=root

hibernate.show_sql=true
hibernate.format_sql=false
hibernate.use_sql_comments=false
hibernate.cache.use_second_level_cache=false
hibernate.cache.use_query_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.hbm2ddl.auto=update
hibernate.order_updates=true
hibernate.jdbc.batch_size=30
hibernate.jdbc.fetch_size=100
hibernate.max_fetch_depth=2

#hibernate4.0事务的模式
#1:org.hibernate.context.internal.ThreadLocalSessionContext - 当前session通过当前执行的线程来跟踪和界定。
#2:org.hibernate.context.internal.JTASessionContext - 当前session根据JTA来跟踪和界定。这和以前的仅支持JTA的方法是完全一样的。
#3:org.hibernate.context.internal.ManagedSessionContext
#4:org.springframework.orm.hibernate4.SpringSessionContext - spring的事务管理。
hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
#Hibernate4.0的查询翻译器:
hibernate.query.factory_class=org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
#Hibernate3.0的查询翻译器:
#hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
#Hibernate2.1的查询翻译器
#hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory


#Connection Pooling

#acquireIncrement: 当连接池中的连接耗尽的时候一次同时获取的连接数。Default: 3
#idleConnectionTestPeriod:检查数据库连接池中控线连接的间隔时间,单位是分,默认值:240,如果要取消则设置为0
#idleMaxAge:连接池中未使用的链接最大存活时间,单位是分,默认值:60,如果要永远存活设置为0
#maxConnectionsPerPartition:每个分区最大的连接数
#minConnectionsPerPartition:每个分区最小的连接数
#partitionCount:分区数,默认值2,最小1,推荐3-4,视应用而定
#acquireIncrement:每次去拿数据库连接的时候一次性要拿几个,默认值:2
#statementsCacheSize:缓存prepared statements的大小,默认值:0
#releaseHelperThreads:每个分区释放链接助理进程的数量,默认值:3,除非你的一个数据库连接的时间内做了很多工作,不然过多的助理进程会影响你的性能

minPoolSize=5
maxPoolSize=20
maxIdleTime=1800
idleConnectionTestPeriodInMinutes=240
maxStatements=0
idleMaxAgeInMinutes=240
maxConnectionsPerPartition=30
minConnectionsPerPartition=5
partitionCount=3
acquireIncrement=5
statementsCacheSize=50
releaseHelperTh