Java Persistence / JPA: @Column vs @Basic

阅读 57

2023-04-11


JPA中Column和Basic的区别是什么? 请看一下下面的代码:

@Basic(fetch=FetchType.LAZY)
@Column(name="WIBBLE")

@Basic(fetch=FetchType.LAZY)
@Column(name="WIBBLE")

  • @Basic signifies that an attribute is to be persisted and a standard mapping is to be used. It has parameters which allow you to specify whether the attribute is to be lazily loaded and whether it's nullable.
  • @Column allows you to specify the name of the column in the database to which the attribute is to be persisted.


精彩评论(0)

0 0 举报