correct code to register a persistence listener