The @PersistenceContext annotation has an optional attribute type, which defaults to PersistenceContextType.TRANSACTION. This default is what you need to receive a shared EntityManager proxy. The alternative, PersistenceContextType.EXTENDED, is a completely different affair: This results in a so-called extended EntityManager, which is not thread-safe and hence must not be used in a concurrently accessed component such as a Spring-managed singleton bean. Extended EntityManagers are only supposed to be used in stateful components that, for example, reside in a session, with the lifecycle of the EntityManager not tied to a current transaction but rather being completely up to the application.
spring boot jpa 환경에서
db에 delete 명령을 보내 row를 삭제하려는 시도 중 발생하였다.
@Transaction 어노테이션을 붙여주면 해결된다. 중복된 request를 방지하려는 목적 이라고 생각된다.
'개발공부 > 시행착오' 카테고리의 다른 글
python python3 alias 변경 (0) | 2020.04.26 |
---|---|
django - No Python interpreter configured for the module (0) | 2020.04.16 |
SpringBoot - JDBC with Session / Error : spring_session table does not exist (0) | 2020.02.16 |
git - 잘못 push한 폴더 삭제하기 (0) | 2020.02.12 |
intellij - @Table(name = " 빨간줄 " ) 이 뜰 경우 빨간줄을 없애는 방법 (0) | 2020.02.07 |