@Lob은 대용량 데이터를 저장할 때 사용한다
오라클의 경우 BLOB, CLOB
MySQL의 경우 BLOB, TEXT와 매핑된다
@Lob은 Java의 데이터 타입에 따라 매핑되는 타입이 달라진다
오라클을 예시로 들자면 아래와 같이 매핑될 수 있다
- BLOB: byte[], java.sql.BLOB
- CLOB: String, char[], java.sql.CLOB
아래는 사용 예이다
@Entity
public class Report{
@Id
private Long Id;
private String title;
//CLOB
@Lob
private String reportContent
//BLOB
@Lob
private byte[] attachedFile;
}'Spring > JPA' 카테고리의 다른 글
| 환경세팅 (0) | 2023.02.24 |
|---|---|
| Entity-Table 매핑 - 필드 매핑(@Transient) (0) | 2023.02.23 |
| Entity-Table 매핑 - 필드 매핑(@Temporal) (0) | 2023.02.23 |
| Entity-Table 매핑 - 필드 매핑(@Enumerated) (0) | 2023.02.23 |
| Entity-Table 매핑 - 필드 매핑(@Column) (0) | 2023.02.23 |
댓글