First attachment (java file) is just core hibernate-envers unit test. Spring behaviour is only simulating with calling entityManager.close() method.