}
//need to do that here rather than in the save event listener to let
//the post insert events to have a id-filled entity when IDENTITY is used (EJB3)
persister.setIdentifier( instance, generatedId, session );
session.getPersistenceContext().registerInsertedKey( getPersister(), generatedId );
entityKey = session.generateEntityKey( generatedId, persister );
session.getPersistenceContext().checkUniqueness( entityKey, getInstance() );
}
//TODO: this bit actually has to be called after all cascades!