开发者

getHibernateTemplate.save() - How get Affected rows / New Auto increment

is there a way that i get back the number of affected rows by using:

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜