when practicing ssh framework integration, implement a function: add data from a local excel table to the database and display it on the page. The result shows an error:
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove "readOnly" marker from transaction definition.
Baidu"s solution is a variety of read-only= "false", as follows:
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- :-->
<tx:method name="save" isolation="DEFAULT" propagation="REQUIRED" read-only="false"/>
<tx:method name="update" isolation="DEFAULT" propagation="REQUIRED" read-only="false"/>
<tx:method name="delete" isolation="DEFAULT" propagation="REQUIRED" read-only="false"/>
<tx:method name="find*" isolation="DEFAULT" propagation="REQUIRED" rollback-for="BuyStockException"/>
</tx:attributes>
</tx:advice>
@ Transactional (readOnly = false, propagation = Propagation.REQUIRES_NEW)
public interface BaseDao < T > {}
and so on.
it is a pity that the report is still wrong. I would like to ask all the bosses for an answer.
hibernate version: 4.3.11