楼上说的你注意一下,如果,使用的是数据源,那么检查下,是否设置的 readonly属性
解决方案 »
- CXF webservice 错误...在线等!
- 刚接触struts 页面查询数据问题
- 关于无ActionForm的Action中的编码问题~
- Java EE高级软件班
- 请问:spring注入怎么写啊??
- 求问<html:errors/>
- 关于解决JSP网站稳定性的问题
- 各位大虾,问一问题,我使用apache的soap提供webservice接口,那么在请求方的服务器上是不是一定也要安装soap.jar还是只在响应webservice
- 在java里怎么同mysql的用jdbc连?
- 免费送内部价值200元的50张北风网的学习卡
- 运行这个程序,出现如下错误,请大家帮忙。
- 用lucene1.4.3做的全文检索,怎么搜索不出来阿拉伯数字,不支持吗?
文件如下:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- ========================= Start of PERSISTENCE DEFINITIONS ========================= -->
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/classes/init.properties</value>
</property>
</bean>
<!-- Choose the dialect that matches your "dataSource" definition -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>${datasource.driverClassName}</value>
</property>
<property name="url">
<value>${datasource.url}</value>
</property>
<property name="username">
<value>${datasource.username}</value>
</property>
<property name="password">
<value>${datasource.password}</value>
</property>
<property name="maxActive">
<value>${datasource.maxActive}</value>
</property>
<property name="maxIdle">
<value>${datasource.maxIdle}</value>
</property>
<property name="maxWait">
<value>${datasource.maxWait}</value>
</property>
<property name="defaultAutoCommit">
<value>${datasource.defaultAutoCommit}</value>
</property>
</bean>
<bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>com/doallin/bean/Test.hbm.xml</value>
<value>com/doallin/bean/TbUserinfo.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>
<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
</props>
</property>
</bean>
<bean id="myTransactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="testDAO" class="com.doallin.service.dao.hibernate.TestHibernateDAO">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="testService" class="com.doallin.service.spring.TestServiceSpringImpl">
<property name="testDAO"><ref local="testDAO"/></property>
</bean>
<bean id="userDAO" class="com.doallin.service.dao.hibernate.UserHibernateDAO">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="userService" class="com.doallin.service.spring.UserServiceSpringImpl">
<property name="userDAO"><ref local="userDAO"/></property>
</bean> </beans>
文件如下:
datasource.driverClassName=org.gjt.mm.mysql.Driver
datasource.url=jdbc:mysql://localhost:3306/doallin
datasource.username=root
datasource.password=111111
datasource.maxActive=10
datasource.maxIdle=2
datasource.maxWait=120000
datasource.defaultAutoCommit=false
datasource.whenExhaustedAction=1
datasource.validationQuery=select 1 from dual
datasource.testOnBorrow=true
datasource.testOnReturn=falsehibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
hibernate.jdbc.batch_size=25
hibernate.jdbc.fetch_size=50
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-drop
文件如下:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" ><!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Thu Mar 30 12:00:15 CST 2006 -->
<hibernate-mapping package="com.doallin.bean"> <class name="TbUserinfo" table="tb_userinfo">
<id name="id" column="id" type="integer">
<generator class="native"/>
</id>
<property name="rid" column="rid" type="integer" not-null="true" />
<property name="username" column="userName" type="string" />
<property name="type" column="type" type="short" not-null="true" />
<property name="password" column="password" type="string" />
<property name="recordtime" column="recordTime" type="string" />
<property name="validtime" column="validTime" type="string" />
<property name="state" column="state" type="short" />
<property name="comment" column="Comment" type="string" />
<property name="modifytime" column="ModifyTime" type="string" />
</class>
</hibernate-mapping>
是这里错了
datasource.defaultAutoCommit=false --》true;