开发者

Proper way to retrieve sequence int after entity save with hibernate and postgresql?

This is how I'm getting the id from save(entity) method:

Serializable save = hibernateTemplate.save(article);
return Integer.valueOf(save.toString());

Being a complete noob to hibernate, I just wonder if this is the proper way to do it? I'll appreciate an开发者_开发知识库y advice.


I think it is unnecessary to use Integer.valueOf(save.toString); because you know type of your identifier and Hibernate of course too. You can use (Integer)save.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜