Is there an option to save new entities with already predefined ids and not get this exception?
If this is really something that you absolutely need, you can use a custom generator like shown in this example: hibernate-orm/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/userdefined/SequenceOrAssignedGeneratorTest.java at 6.6 · hibernate/hibernate-orm · GitHub
Allowing to re-persist data that was previously removed could be sign of a defect in your application though, so be careful what you’re doing.