I am using Hibernate 3.6.3 Final and Hibernate Search 3.4.1. I wrote an HQL delete query. The objects are deleted from the database but they are not removed from the Lucene Index after the transaction completes. Here is the query:
Session session = factory.getCurrentSession();
Query q = session.createQuery("delete from Charges cg where cg.id in (:charges)");
q.setParameterList("charges", chargeIds);
int result = q.executeUpdate();`
What am I missing? What do I need to do to solve issue?
I created a PostDeleteEvent, hoever the FullTextEventListener doesn't appear to be receiving the event:
SessionImpl sessImpl = (SessionImpl) factory.getCurrentSession();
SessionImplementor implementor = sessImpl.getPersistenceContext().getSession();
EntityPersister persister = implementor.getEntityPersister("Charges", cg);
EntityEntry entry = sessImpl.getPersistenceContext().getEntry(cg);
Object[] deletedState = new Object[]
{ cg};
entry.setDeletedState(deletedState);
PostDeleteEvent pdEvent = new PostDeleteEvent(entry, entry.getId(), deletedState,
entry.getPersister(), (EventSource) sessImpl);`
Thank you.