Hello, I don’t seem to understand how to get index of two linked tables with intermediate one.
Here is my model:
Profile:
@Entity
@Indexed
public class Profile extends AbstractEntity {
@Lob
@Column(name = "first_name")
@Field(termVector = TermVector.YES)
String firstName;
@Lob
@Column(name = "last_name")
@Field(termVector = TermVector.YES)
String lastName;
@OneToMany(mappedBy = "profile", cascade = CascadeType.ALL)
@IndexedEmbedded(depth = 2, includePaths = {"speciality.name"})
Set<ProfileSpeciality> specialities = new LinkedHashSet<>();
}
ProfileSpeciality:
@Entity
public class ProfileSpeciality implements Serializable {
@EmbeddedId
@IndexedEmbedded
ProfileSpecialityId id = new ProfileSpecialityId();
@ManyToOne
@MapsId("profile_id")
@JoinColumn(name = "profile_id", foreignKey = @ForeignKey(name = "profile_specialities_profile_fk"))
@ContainedIn
Profile profile;
@ManyToOne
@MapsId("speciality_id")
@JoinColumn(name = "speciality_id", foreignKey = @ForeignKey(name = "profile_specialities_speciality_fk"))
@ContainedIn
@Field(name = "speciality")
Speciality speciality;
Integer priority;
And finally Speciality:
public class Speciality extends AbstractEntity {
@Lob
@Column
@NaturalId
@ContainedIn
String name;
}
I want the index to be just for the Profile as the search will be around it, and I want to also index the related Specialities for that profile.
With the current code the error I get when I start the indexing is:
org.hibernate.search.exception.SearchException: HSEARCH000135: Unable to guess FieldBridge for speciality in model.Speciality
Any help is appreciated!
Thanks