| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- spring boot
- beakjoon 1697
- CodingTest
- beakjoon11725
- beakjoon
- attvalue
- baekjoon 4963
- 백준 섬의갯수
- Error
- websecurityconfiguration
- baekjoon 16953
- 백준 2667 java
- 단지 번호붙이기
- baekjoon 3187
- baekjoon 14714
- baekjoon 2468
- exprectedbelow
- java.lang.nosuchmethoderror
- baekjoon1012
- BFS
- 안전영역 java
- 백준 현수막
- baekjoon 2667
- dfs
- html error
- coding test
- bytebuddyinterceptor
- springboot
- baekjoon
- backjoon 16173
- Today
- Total
NOT FOUND
jakarta.persistence.EntityExistsException: detached entity passed to persist 본문
jakarta.persistence.EntityExistsException: detached entity passed to persist
이종은 2025. 7. 3. 13:59detached entity passed to persist: kr.co.infra.rdb.goal.entity.GoalEntity jakarta.persistence.EntityExistsException: detached entity passed to persist: kr.co.infra.rdb.goal.entity.GoalEntity at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:126) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:167) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:173) at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:767) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:745) at org.springfr...
아이디를 넣어서 생성하려고 할 때 나는 에러.
더 정확하게는 이미 식별자가 존재하는 엔티티를 persist 하려고 하면 나는 에러다.
persist()는 새로운 엔티티를 저장할 때 쓴다. (id가 없거나 영속성 컨텍스트에 없는 상태)
만약 id를 생성자에서 미리 넣고 저장하고 싶다면 merge()를 쓰면 된다.