Hi,
I'm new to Hibernate Search and Lucene and just run into a problem with indexing associated entities and sub classes.
Here the simplified domain model:
Code:
@Indexed
class A {
@IndexEmbedded
Set<C> setC;
...
// some indexed properties
}
abstract class B {
@IndexEmbedded
D classD;
}
class C extends B {
@ContainedIn
A classA;
}
class D {
@ContainedIn
Set<B> setB;
@Field
String name;
}
Class A contains several class C objects.
Class C is a subclass of class B.
Class B contains a reference to class D.
Class D contains a field (name) we want to index.
If we update an existing class C object everything works fine. But if we add or remove one class C object, the index isn't updated. Ok, the index is updated as we can see in the log, but the added/removed object is not included.
If we add two class C objects to a class A object, the first one is added to the index but the second not. So it just seems that the last one added is missing. Although it is in the database. If we add now another object the second one is indexed. It looks like the class A object that is used for indexing is not updated correctly (doesn't contain the reference to the added class C object).
We first thought that some Listener might not get the add event, but we added org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate in Trace mode to our log and the index for the corresponding class A object is updated, but without the added object.
Does someone have an idea on this? Am I missing something? If you need more information please let me know.
Thanks in advance!
Versions:
Spring 2.5.6.SEC01
hibernate-core 3.3.1.GA
hibernate-annotations 3.4.0.GA
hibernate-search 3.1.0.GA