Example: I have the Person class below:
@Entity
public class Pessoa {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idPessoa;
private String nome;
//getters e setters
}
Hibernate, by default, persists in the database a String as Varchar, and I want to persist in the database as text and change to the following configuration:
@Entity
public class Pessoa {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idPessoa;
@Column(columnDefinition = "text")
private String nome;
//getters e setters
}
Adding the annotation "@Column (columnDefinition=" text ")" into the String attribute, and for this to persist as text, I am dropping the table already created in the database, and my question is:
Would there be a way for me not to drop the table in the database, since in a more complex system, can this cause me consistency problems?