在Hibernate中新增一条数据,同时获得该数据的id

首先

new 一个

然后

saveOrUpdate(project);

最后

id = project.getId();

搞定

你可能感兴趣的:(hibernate)