ERROR: cannot perform UPDATE in a read-only transaction

1, version

insert image description here

2. Problem

Caused by: org.postgresql.util.PSQLException: 错误: 不能在一个只读模式的事务中执行UPDATE
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)

3. Solution

transaction configuration

	<tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
		  	<tx:method name="get*" read-only="true"/>
			<tx:method name="is*" read-only="true"/>
			<tx:method name="find*" read-only="true"/>
			<tx:method name="*" isolation="DEFAULT"/>
		</tx:attributes>
	</tx:advice>

@Transactional annotation processing

Guess you like

Origin blog.csdn.net/riding_horse/article/details/130270916