I use hibernate and postgres What is the difference between

@Column(length = 1000) private String string; 

and

 @Column(columnDefinition = "text") private String string; 

In the first case, the length of the string that can be stored in the database is clearly indicated. And in the historical case, what is the default value for the length of the string that can be stored in the database? Will the JPA model be changed if the second case is used instead of the second case or vice versa?

    1 answer 1

    The type of the table field in the first case will be varchar(1000) , and in the second text . The text type is not limited in length. You can also save gigabytes of text in fields of this type.