由于目的,我需要在插入后立即获取对象的id.我可以使用这段代码:
session.save(Object o) // insert to database findByPorperty( o.property ) // Return the inserted object along with the id
我认为上面的代码是不够的,因为会话需要重新打开才能找到对象.所以:
hibernate
hibernate ×1