Problem inserting data into the database

0

I'm trying to insert a mass of data into the Mysql database using Hibernate. However I have the following error:

18:15:30,221 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 59) HHH000388: Unsuccessful: INSERT INTO tb_pessoa_fisica (id,nome,cpf,telefone_comercial,telefone_residencial,telefone_celular,email,idade,data_nascimento) VALUES (92,"Zeph Damon Maddox","64871487509","(14)3523-6032","(55)8246-5275","(38)7000-8218","[email protected]",58,"2015-04-26")
18:15:30,221 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 59) Data truncation: Data too long for column 'cpf' at row 1

My attribute is like this in java:

@NotBlank
@Pattern(regexp="\d{11}", message="ATENÇÃO: Deve ser informado 11 dígitos!")
@Column(columnDefinition="char(11)", nullable=false)
private String cpf;

Does anyone help me to understand this problem and solve it?

    
asked by anonymous 27.04.2016 / 23:23

2 answers

0

The main problem was that hibernate did not delete this table in question, before there was a field problem with a lower value than it tried to insert. After deleting the table manually, I circled again and it worked.

    
12.05.2016 / 22:22
1

18: 15: 30,221 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool - 59) Data truncation: Data too long for column 'cpf' at row 1

I noticed that the above line is giving problem in the CPF column

The information is very large and being truncated. See if your cfp column is as String? How are the notes in this column?

Check if you can not find any problems post the class to verify.

    
29.04.2016 / 13:30