I have an object named MyItemBean that can have 0 or more related KeywordBean objects. The resulting classes are as follows:
@Entity public class MyItemBean { ...stuff... @ManyToMany(targetEntity = KeywordBean.class, cascade = CascadeType.PERSIST) @JoinTable(name = "tbl_item_keyword", joinColumns = @JoinColumn(name = "item_id"), inverseJoinColumns = @JoinColumn(name = "keyword_id")) private List<KeywordBean> keywords = null; ...more stuff... } @Entity public class KeywordBean { ...stuff... private String value=null; ...more stuff... }
I use JBoss Seam / Hibernate Search to index these objects so that I can perform search queries against them. I would like to be able to search for instances of MyItemBean with a given keyword value. This relationship, however, is unidirectional because I apply KeywordBean objects KeywordBean more than MyItemBean . I looked at the Hibernate Search documentation for examples of how to index relationships, but all the examples they provide are bidirectional. Can someone tell me which annotations I need to apply on MyItemBean.keywords in order to index keyword values ββcorrectly?
source share