getHibernateTemplate.save() - How get Affected rows / New Auto increment
getHibernateTemplate().save(bean);
what is the point using save if you dont know what happened in the end.
Or, if i insert a new row, i want to get the new PK AI that was created....A开发者_如何学运维ny idea?
Thanls
is there a way that i get back the number of affected rows by using:
Not for the "save" operation, which is quite understandable. But if you are using a Query
, the executeUpdate
method returns the number of affected records.
what is the point using save if you dont know what happened in the end.
Well, if there's no exception, you can assume everything went as expected.
Or, if i insert a new row, i want to get the new PK AI that was created....
Hibernate updates the persisted bean with the generated PK. So, if your bean has a long id
, set with auto-increment, Hibernate will populate this field once it gets persisted.
精彩评论