작성
·
1.1K
0
다음과 같이 메소드를 선언하고 test를 수행하면
public interface StockRepository extends JpaRepository<Stock, Long> {
@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("select s from Stock s where s.id =:stockId")
Optional<Stock> findById(@Param("stockId") Long stockId);
}
Caused by: java.sql.SQLException: Cannot execute statement in a READ ONLY transaction.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:972)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57)
... 109 more
위와 같은 에러가 발생하는데요...어떻게 해결할 수 있나요?
혹시 github 을 통해서 소스공유를 해주실 수 있으실까요 ?
저부분만 보고서 원인을 파악하기는 쉽지않네요 :)