您可以使用persist()方法而不是save()。
https://forum.hibernate.org/viewtopic.php?f=1&t=1011405
但是,与save()不同,persist()不保证将在持久实例上立即设置标识符值。
https://forum.hibernate.org/viewtopic.php?t=951275

您可以使用persist()方法而不是save()。
https://forum.hibernate.org/viewtopic.php?f=1&t=1011405
但是,与save()不同,persist()不保证将在持久实例上立即设置标识符值。
https://forum.hibernate.org/viewtopic.php?t=951275