@Entity
@Indexed
public class Group{
@Field
private boolean someBoolean;
@OneToMany(mappedBy="group")
@ContainedIn
private Set<Base> comments;
}
@Entity
@Indexed
public abstract class Base{
@ManyToOne
@IndexedEmbedded(includePaths={"someBoolean"})
private Group group;
}
@Entity
@Indexed
public class Comment extends Base{
@ManyToOne
private Post post;
}
@Entity
@Indexed(interceptor=PostIndexingInterceptor.class)
public class Post extends Base{
@OneToMany(mappedBy="post")
private Set<Comment> comments;
}
public class PostIndexingInterceptor implements EntityIndexingInterceptor<Post> {
[...]
}
So, in this scenario, I'm seeing ClassCastExceptions on the PostIndexingInterceptor where it tries to run against Comments. So, although having comments referenced in both Group and Post is a bit awkward, technically, this should work AFAIK.
|