I have 2 entities - Manufacturer and Product.
Manufacturer has property “status” which can be Pending, Enabled, Disabled…
And of course, Product entity has a property Manufacturer.
In order to have fast search on Product entity, I use Hibernate Search.
In Product entity I have a bridge to Manufacturer which puts “STATUS_ENABLED” or “STATUS_DISABLED” to the Product index depending on the status of its Manufacturer.
Using that I can filter out products from disabled manufacturers without SQL and joins.
Later when I update Manufacturer by changing its state (e.g. from Enabled to Disabled), product index is not updated (of course).
Is there any way to bind properties between entities or make a dependency somehow or anything similar in order to initiate automatic updates on dependent entity index?
I am aware it can be done manually by triggering index rebuild, but I would like to avoid this. Also I could get all the products from updated manufacturer and update them one by one, but still it takes more effort comparing to automatic update that might be configured.