1

I understand what this message means, but I do not understand why it is giving this message. I say this because I'm not trying to update this field.

Column definition:

@Column(name="company_name") private String companyName; 

Then I create a Query using EntityManager.

Query

query = em.createQuery("update Client set companyName = :companyName" + " where id = :id"); query.setParameter("companyName", client.getCompanyName()); query.setParameter("id", client.getId()); query.executeUpdate(); 

And the exception reads: Data truncation: Data too long for column 'company_cnpj' at row 1

But I'm not changing the 'company_cnpj' row. Why is it giving me this error?

1 Answer 1

2

Strings in the database always have a length; since you didn't specify one, it defaults to 255. This post tells you how to change it:

hibernate property string length question

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.