Transaction Rollback

Is there any support for a transaction rollback? I have an class with a multi-valued association. The SaveOrUpdate is called in a transaction. The object saves successfully, but saving the association causes an exception, triggering a rollback. After the rollback the object is, of course, not in the database, but the object is in the ObjectManager with an ID. What the recommended way to clean up after a rollback?

 

If an exception is raised when persisting objects, you have to drop the object manager and create a new one, or clear the objects. It becomes in an invalid state and must be discarded.