hazelcast/hazelcast-hibernate

Topic notifications not sent in a few scenarios in hazelcast-hibernate53

dohertyfjatl opened this issue · 2 comments

There are a couple of scenarios in hazelcast-hibernate53 where the topic notifications are not being sent, whereas they are being sent in previous versions.

As an example, the following code fails to send a topic notification for the deletion:

    @Test
    public void testDeleteOneEntity() {
        DummyEntity entity = new DummyEntity(0L, "dummy:0", 0, new Date());

        Session session = sf.openSession();
        Transaction tx = session.beginTransaction();
        try {
            session.save(entity);
            tx.commit();
        } 
           // .. catch finally
        }

        try {
            session = sf.openSession();
            tx = session.beginTransaction();
            DummyEntity entityToDelete = session.get(DummyEntity.class, entity.getId());
            session.delete(entityToDelete);
            tx.commit();
        } 
           // .. catch finally
        }

        assertEquals(1, instance.getTopic(DummyEntity.class.getName()).getLocalTopicStats().getPublishOperationCount());
    }

I have raised the following PR with a potential fix for the issue, plus some tests:
#51

I double-checked and it looks like it was fixed already.