What does the length attribute do when set on the @Column JPA annontation?

后端 未结 3 1170
臣服心动
臣服心动 2020-12-04 15:32

What exactly does setting the length on a column do in JPA?

@Column(name = \"middle_name\", nullable = false, length = 32)
public String getMiddleName() {
           


        
3条回答
  •  鱼传尺愫
    2020-12-04 15:38

    @Column(length=32) is only for DDL purpose and not for restricting means it allows more than 32 characters unless at table level it is not restricted.To restrict size we should go for @Size(max=32)

提交回复
热议问题