1

I have a class like this, with a String field that can contain a lot of text:

@Entity
@Table (name = "books")
public class Book  {
  ...
  //long description - exceeds char(255) limit
  private String description;
  ...
}

By default Hiberante creates a character varying(255) column for that field, which is too small. How do I get it to make a column for that particular field, for instance, text or varchar(1000)?

Anish B.
  • 9,111
  • 3
  • 21
  • 41
parsecer
  • 4,758
  • 13
  • 71
  • 140

1 Answers1

1

You can do by setting columnDefinition as TEXT.

@Entity
@Table (name = "books")
public class Book  {
  ...
  @Column(name = "description", columnDefinition="TEXT") 
  private String description;
  ...
}
Anish B.
  • 9,111
  • 3
  • 21
  • 41