hibernate打印sql日志:在sessionFactory加入hibernate.show_sql=true
批量插入数据报错:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update
解决办法:
@SQLInsert(sql = "INSERT INTO t_vts_vesseltrip(id, mmsi, shipname, shiptype, lon, lat, sog, cog, navstatus, "+
"destination, eta, draught, meetevent, meettchannel, channeloverspeed, "+
"channellowspeed, channelunpower, channeltraverse, anchorevent,"+
"strandedevent, shipanomaly, oppchannel, overload, updatetime)"+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, "+
"?, ?, ?, ?, ?, ?,"+
"?, ?, ?, ?, "+
"?, ?, ?, ?, ?);",
check = ResultCheckStyle.NONE)
批量插入数据报错:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update
解决办法:
@SQLInsert(sql = "INSERT INTO t_vts_vesseltrip(id, mmsi, shipname, shiptype, lon, lat, sog, cog, navstatus, "+
"destination, eta, draught, meetevent, meettchannel, channeloverspeed, "+
"channellowspeed, channelunpower, channeltraverse, anchorevent,"+
"strandedevent, shipanomaly, oppchannel, overload, updatetime)"+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, "+
"?, ?, ?, ?, ?, ?,"+
"?, ?, ?, ?, "+
"?, ?, ?, ?, ?);",
check = ResultCheckStyle.NONE)
本文解决使用Hibernate框架时遇到的打印SQL日志和批量插入数据时报错的问题,通过设置hibernate.show_sql=true并提供了一个自定义的SQL插入注解来解决StaleStateException。
8368

被折叠的 条评论
为什么被折叠?



