Hi,
i have the following problem: - user enters data into a form - form data is stored inside a java object - saveOrUpdate is called; now the insert of the new object fails due to a unique constraint violation - the user corrects his data and tries again to store the data
The problem is, when saveOrUpdate is called again, hibernate tries to update the database instead of an insert, cause the id of the object is already set. Right now my workaround is to copy the complete object-graph and reset my object if the insert fails.
Is there any "cleaner" hibernate solution to reset the generated id's? (Or is there any better solution then to use saveOrUpdate?)
Best regards
peter
|