Hi,
this should be possible.
Basically you have to create a listener "after persist", "after update", "before delete"
for the entities A and B and use them like a "hibernate trigger".
If you use JPA (entitymanager) you define one annotating a method on the entity
itself, when using plain hibernate you implement a listener like
http://fisheye.jboss.org/browse/Hibernate/search/trunk/src/java/org/hibernate/search/event/FullTextIndexEventListener.java?r=11631To avoid to exception you're getting, you'll have to load the C entity from database;
You'll need to be able to find out which primary key you're going to need to load C from the A or B entity. After you've loaded C use index(object) to update it's state.
For deletions, you'll need to use purge() before you delete it.
Please keep us updated about how this works out, I'm unsure about the loading of an entity after the commit phase.