我正在尝试用hibernate更新MySQL表。看起来它确实有效,hibernate的结果是1,但表不会改变。我的更新代码:
Session session = GeneralSession.getSession();
session.beginTransaction();
//some code - initialization and logics
//loop
Query updateDuplicity = session .createSQLQuery("UPDATE `t_inzerat` set `actual` = 'D'
WHERE `id` = "+ idSimi);
int resultUpdate = updateDuplicity.executeUpdate();
session.flush();
//end of loop
session.getTransaction().commit();
在控制台中,hibernate将其写为:
Hibernate: UPDATE `t_inzerat` set `actual` = 'D' WHERE `id` = 5611
Affected rows : 1
请问有什么问题?谢谢