Я использую Hibernate Search с Lucene.Я хотел бы найти текст в таблице соединения.У меня есть таблица пользователей:
@Entity
@Table(name = "user_user")
@Data
@EqualsAndHashCode(callSuper=false)
@Indexed
@Where(clause = "is_delete <> 'Y'")
public class User extends CommonColumn {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
@ManyToOne(fetch = FetchType.EAGER)
@Field(termVector = TermVector.YES)
@JoinColumn(name = "fk_department")
@JsonBackReference
UserDepartment userDepartments = new UserDepartment();
}
и в моем UserDepartment
@Entity
@Table(name="user_department")
@Data
public class UserDepartment {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
@Column(name="department_name")
private String departmentName;
@OneToMany(mappedBy = "userDepartments")
@JsonManagedReference
private List<User> users = new ArrayList<User>();
}
и в моем сервисе
org.apache.lucene.search.Query query = queryBuilder
.keyword()
.wildcard()
.onFields("fullName", "email", "mobileNumber", "isActive", "userDepartments")
.matching(queryString + "*")
.createQuery();
Но я получаю ошибку:
Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.exception.SearchException: HSEARCH000135: Unable to guess FieldBridge for userDepartments in com.company.models.UserDepartment
Пожалуйста, помогите.Спасибо.