【发布时间】:2010-08-12 13:37:55
【问题描述】:
这就是我从 save(entity) 方法中获取 id 的方式:
Serializable save = hibernateTemplate.save(article);
return Integer.valueOf(save.toString());
作为一个完全冬眠的菜鸟,我只是想知道这是否是正确的方法? 我会很感激任何建议。
【问题讨论】:
标签: java hibernate postgresql orm
这就是我从 save(entity) 方法中获取 id 的方式:
Serializable save = hibernateTemplate.save(article);
return Integer.valueOf(save.toString());
作为一个完全冬眠的菜鸟,我只是想知道这是否是正确的方法? 我会很感激任何建议。
【问题讨论】:
标签: java hibernate postgresql orm
我认为没有必要使用Integer.valueOf(save.toString);,因为您当然也知道标识符的类型和 Hibernate。你可以使用(Integer)save。
【讨论】: