Java Persistence / JPA: @Column vs @Basic

后端 未结 4 783
一整个雨季
一整个雨季 2020-12-22 17:31

What is the difference between @Column and @Basic annotations in JPA? Can they be used together? Should they be used together? Or does one

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 18:31

    In addition to @djna's answer, it is worth noting that @Basic should be compared with @OneToMany, @ManyToOne and @ManyToMany. Only one of these can be specified on any property.

    @Column and @JoinColumn can be specified along with any of these to describe the database column properties.

    These are two sets of annotations that can be used together, but only one annotation of each set can be used at a time.

提交回复
热议问题