Listener is running twice for single entry

I had posted similar issue couple of years ago here and seems like facing it again. When I debugged it, noticed that the following piece of code is running twice and do not see any other Listener that may trigger it.

Here is my code in Listener:

public void onBeforeInsert(MaterialReceiptVendorLine entity, EntityManager entityManager) {
    crudUpdate(entity, "create");

    PurchaseOrderLine line = entityManager.merge(entity.getPurchaseOrderLine());


here is the codes called:

    private void crudUpdate(MaterialReceiptVendorLine entity, String crudAction){
        EntityManager em = persistence.getEntityManager();

        MaterialReceiptVendor materialReceiptVendor = em.merge(entity.getMaterialReceiptVendor());
        PurchaseOrderType purchaseOrderType = em.merge(materialReceiptVendor.getPurchaseOrderType());

        if(crudAction.equalsIgnoreCase("create")) {
            if (!purchaseOrderType.getPurchaseOrderCategory().equals(PurchaseOrderCategory.ASSETS)) {
                materialsManagementService.materialBalanceUpdate(entity.getMaterialReceiptVendor().getPlant(), entity.getMaterial(), entity.getQuantity(), "add");
                materialsManagementService.updateMaterialTranDetail("create", entity.getMaterialReceiptVendor().getPlant(), entity, null, null, null, null);
        }else ......

Service codes are attached.materialManagementService.txt (4.7 KB)
I do not have any Listener that may trigger change to this Entity (MaterialReceiptVendorLine).
Anyone has any suggestions?

What I have noticed after further investigation (debug) that it is repeated when there is more than one composite Entity and both of them has entityListener.

Hi Mortoza,

BeforeInsertEntityListener is normally invoked for an entity instance once per transaction.
Could you reproduce the issue in a test project?