java - Hibernate : Column count doesn't match value count at row 1 -
i using hibernate 5 , spring 4. executing following sql query , getting error
caused by: java.sql.sqlexception: column count doesn't match value count @ row 1
sqlquery query = getsessionfactory().getcurrentsession().createsqlquery(" update irms_deleted_data set reason=:reasonstr irms_id=:id "); query.setstring("reasonstr", "abcd1234"); query.setinteger("id", irmsdata.getid()); query.executeupdate();
any idea why getting error?
i tried following (simple hibernate example)
create table irms_deleted_data (reason varchar2(10), irms_id number(11,0)); insert irms_deleted_data values ('xyz', 1);
wrote function:
private void updateirmsdeleteddata() { transaction tx = null; session session = factory.opensession(); try { tx = session.begintransaction(); sqlquery query = session.createsqlquery("update irms_deleted_data set reason=:reasonstr irms_id=:id"); query.setstring("reasonstr", "abcd1234"); query.setinteger("id", 1); query.executeupdate(); } catch (exception e) { e.printstacktrace(); } tx.commit(); session.close(); }
and worked....
also can check if there trigger on irms_deleted_data doing causing issue...
Comments
Post a Comment