spring boot data jpa 생 성 표 의 긴 텍스트 필드
1. 어떻게 만 듭 니까?
@ Lob 레이 블 은 데이터베이스 가 지원 하 는 대상 유형, Clob 또는 Blog 로 속성 을 표시 합 니 다.그 중:
@ Basic 은 데이터베이스 시트 의 필드 에 속성 을 표시 합 니 다.@ Entity 에 표 시 된 실체 클래스 의 속성 입 니 다. 표시 가 없 으 면 기본 값 은 @ Basic 입 니 다. 예 를 들 어 User 클래스 의 name 과 email 속성 입 니 다. @Basic 은 두 가지 상용 속성 이 있 습 니 다:
실체 클래스 의 속성 이 매 핑 된 데이터베이스 시트 의 열 이름과 다 르 면 @ Colunm 로 표시 할 수 있 습 니 다.이 레이 블 은 데이터베이스 시트 의 이 필드 에 대한 상세 한 정 의 를 설명 합 니 다.
columnDefinition: 이 필드 가 데이터베이스 에 있 는 실제 유형 을 표시 합 니 다.일반적으로 ORM 프레임 워 크 는 속성 유형 에 따라 데이터베이스 에 있 는 필드 의 유형 을 자동 으로 판단 할 수 있 지만 예외 가 있 습 니 다.
@Entity
public class Commodity {//
@Id @Column(length = 20) private String cid;
@Column(length = 40) private String cname;
private Integer price;//
private Integer stock_quantity;//
private Integer Sales_volume;//
@Lob @Basic(fetch = FetchType.LAZY) @Column(columnDefinition = "text") private String description;//
@ManyToOne(cascade = CascadeType.ALL) private Category category;
public Commodity(){
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getStock_quantity() {
return stock_quantity;
}
public void setStock_quantity(Integer stock_quantity) {
this.stock_quantity = stock_quantity;
}
public Integer getSales_volume() {
return Sales_volume;
}
public void setSales_volume(Integer sales_volume) {
Sales_volume = sales_volume;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.