| Thank you for your report. Unfortunately, your test case has a bug in it. When you create/change associations, you should take care to update both sides of the associations so that Hibernate Search is able to detect changes correctly and to reindex as required. In particular, you do this:
B b = new B(a, c1);
Transaction tx2 = s.beginTransaction();
s.persist(b);
tx2.commit();
Whereas you should really do this:
Transaction tx2 = s.beginTransaction();
s.refresh(a);
s.refresh(c1);
B b = new B(a, c1);
a.getbCollection().add( b );
c1.getbCollection().add( b );
s.persist(b);
tx2.commit();
Note that this is not only a Hibernate Search requirement, but actually a best practice even when not using Hibernate Search, which will certainly spare you some bugs in your business code. I'm going to close this ticket as rejected. Feel free to comment on it if you need additional information. |