Replies: 1 comment
-
해당 어노테이션은 아래와 같이 필드를 추가하여 작성합니다. version 필드는 Reservation 엔티티가 변경될 때마다 자동으로 증가합니다. @Entity
public class Reservation {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private ReservationTime time;
@Version
private int version;
} version 충돌이 발생하면 OptimisticLockException을 발생시킵니다. 트랜잭션은 예외로 인해 롤백됩니다. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
.
Beta Was this translation helpful? Give feedback.
All reactions