sql - Hibernate: data truncated at primary key column -


i know question "data truncated" in sql many in stack overflow. question has little different , can't find answer that.

it's truncated in primary key when i'm doing update statement.

my function update sql:

public void updatelistdata(string newid, string oldid) {         stringbuilder sql = new stringbuilder("update card_info c ");         sql.append("set c.xxx_id = :newid ");         sql.append("where c.xxx_id <> '' , c.status = 1 , c.is_private = 1 , c.delete = 0 , c.xxx_id = :oldid ");          query query = getentitymanager().createnativequery(sql.tostring());         query.setparameter("newid", newid);         query.setparameter("oldid", oldid);          query.executeupdate();      } 

my log:

warn : org.hibernate.engine.jdbc.spi.sqlexceptionhelper - sql error: 1265, sqlstate: 01000 error: org.hibernate.engine.jdbc.spi.sqlexceptionhelper - data truncated primary key column: <card_id> 

i can't resolve error. please me. thank all!

i think try update cardid not number value, or big column type, e.g. an int can accept values between -2147483648 2147483647. suggest add validation parameter newid before make update query.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -