Hi, I'm having problems using @IndexedEmbedded on a bi-directional OneToMany indexed collection relationship. My entities look like this:
Code:
@Entity
@Indexed
class Item {
...
@OneToMany(targetEntity = Bid.class)
@IndexedEmbedded
@IndexColumn(name = "bidIdx")
public List<Bid> getBids() {
return bids;
}
}
@Entity
class Bid
...
@ManyToOne(targetEntity = Item.class)
@JoinColumn(insertable = false, updatable = false, nullable = false)
@ContainedIn
public Item getItem() {
return item;
}
@Field(index = Index.TOKENIZED, store = Store.NO)
public String getStringValue() {
return stringValue;
}
Actually our problem differs a little bit, but basically it's a bidirectional indexed relationship between an item and its bids. In Hibernate the suggested way to do this is like above, namely to map this from the collection side, because of the @IndexColumn. Now, nothing about an item's bids is written to the index. I'm having the feeling that this has something to do with the fact, that this relationship isn't really bidirectional (no mappedBy).
What do you think?