Hi,
when I try to change db from HSQLdb to MySQL I get I get an exception when I try to increase to prices from priceincrease.htm:
The parte of the applicationContext.xml that I think i relatet to db stuff:Code:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [update products set description = ?, price = ? where id = ?]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
If I change the <tx:advidce> to:Code:<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${db.driver}"/> <property name="url" value="${db.url}"/> <property name="username" value="${db.user}"/> <property name="password" value="${db.pw}"/> <property name="poolPreparedStatements" value="true"/> </bean> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:jdbc.properties</value> </list> </property> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <aop:config> <aop:advisor pointcut="execution(* *..ProductManager.*(..))" advice-ref="txAdvice"/> </aop:config> <tx:advice id="txAdvice"> <tx:attributes> <tx:method name="save*"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice>
then everyting works fine. Can someone point me to the right direction for setting up MySQL?Code:<tx:advice id="txAdvice"> <tx:attributes> <tx:method name="save*"/> <tx:method name="*" read-only="false"/> </tx:attributes> </tx:advice>


Reply With Quote
