hi all,
I am facing a problem with my hibernate search application. I have two entities: Author, Item. I have a third one called Rol meaning that an author has some rol in the item.
_ _ ROL(Item,Author,Rol) _ _
| |
| |
| |
Author Item
I have been checking in internet and Hibernate Search in action book, but i didnt find something similar. In page 136 there is an example but not with Rol entity.
My problem is that i want to create an author index and an item index. If i modify the author name, i would like to update automatically my Item index. I have been playing a little bit with @IndexedEmbbeded and @ContainedIn but i couldn't make it. It tooks a lot time to index all instances...
I would like to know how should i annotate my entities.
Code:
public class AuthorItemRolEntity implements Serializable
{
..........
@ContainedIn
private ItemEntity item;
@IndexedEmbedded
//@ContainedIn
private AuthorEntity author;
/** The rol. */
private Rol rol;
..........
}
@Indexed
public class AuthorEntity implements Serializable
{
..........
/** The nombre. */
@Field(name = "name_normalized", index = Index.UN_TOKENIZED, indexNullAs = "NULL")
protected String name;
@ContainedIn
protected List<AuthorItemRolEntity> authorItemRol;
@IndexedEmbedded
protected List<NameAutoridadEntity> authorName;
..........
}
public class ItemlEntity implements Serializable
{
@IndexedEmbedded(depth=2)
protected List<AuthorItemRolEntity> authorItemRol;
Thanks in advance,