Listener in RC6.3.0

Noticed a change in Listeners where EntityManager has been passed as a parameter

public class ProductionGrLinesListener implements BeforeDeleteEntityListener<ProductionGrLines>, BeforeInsertEntityListener<ProductionGrLines>, BeforeUpdateEntityListener<ProductionGrLines> {

    private Persistence persistence;

    private Metadata metadata;

    public void onBeforeDelete(ProductionGrLines entity, EntityManager entityManager) {

what is the exact change, do I have to use this entity manager instead of calling from as follows:

 private void updateInsertBalance(JournalDetail operation) {
        EntityManager em = persistence.getEntityManager();

Or both should work?

Both will work, you don’t have to change your code.
The signatures have been changed for the following reasons:

  • to make more explicit the fact that in Before listeners you can work with EntityManager, and in After listeners you can work only directly with the database using JDBC Connection
  • if you use multiple data stores in the application, you get an EntityListener for the appropriate data store.

Thank you for the clarification and help.