Is there a way to add single member index on members of a object member which is not configured embedable but is/are mapped by id like the two members below.
@Entity public class Customer { @MapsId @ManyToOne(fetch = FetchType.LAZY) private Merchant merchant; @MapsId @ManyToOne(fetch = FetchType.LAZY) private List<Store> stores; // Setter/Getter }
So I wanted to add index on Customer for merchant.name or on stores.name given those merchant and Store class has the corresponding fields.
e.g.
@Entity @Indices({ @Index(members={"merchant.name"}), @Index(members={"stores.name", ...etc... }) } public class Customer { ... }
There is a documentation says it works on embedded objects only. So since it reference only, what is suggested way of doing this?
Hope to hear your advice and solutions.