springbootspring boot 学习笔记

spring boot data jpa 创建表中长文本字段

2018-05-21  本文已影响143人  wnyto

0.使用场景

test

1.如何创建

@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;
  }
}


上一篇 下一篇

猜你喜欢

热点阅读