0
I am 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;
Someone help me understand this problem and solve it?
check these parameters <Property name="Hibernate.hbm2ddl.auto" value="update"/> <Property name="Hibernate.dialect" value="org.hibernate.dialect.Mysql5dialect"/> No persistence.xml
– Marcelo
@Marcelo Está assim: <!-- language: java --> <Property name="Hibernate.hbm2ddl.auto" value="create-drop" /> <Property name="Hibernate.show_sql" value="true" /> <Property name="Hibernate.dialect" value="org.hibernate.dialect.Mysql5dialect" /> <Property name="Hibernate.format_sql" value="true" /> <Property name="Connection.pool_size" value="5" />
– Roknauta