spring-data-jpa HSEARCH700020:无法在类型“com. codecode.demo.entity.Posting”上找到路径“.addresss”上关联的反向端< collection>

j2cgzkjk  于 2022-11-10  发布在  Spring
关注(0)|答案(1)|浏览(117)
@Getter
@Setter
@NoArgsConstructor
@Indexed
@Entity
@Table(name = "Posting")
public class Posting implements Serializable {

/**
 * 
 */
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

@Column(name = "job_name")
@FullTextField()
private String jobName;

@Column(name = "position")
@FullTextField()
private String position;

@Column(name = "descriptions", length = 3000)
@FullTextField()
private String description;

@Column(name = "gender_requirement")
@FullTextField()
private String genderRequirement;

@Column(name = "job_requirement", length = 4000)
@FullTextField()
private String jobRequirement;

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "posting_address", joinColumns = @JoinColumn(name = "posting_id"), inverseJoinColumns = @JoinColumn(name = "address_id"))
@EqualsAndHashCode.Exclude
@ToString.Exclude
@JsonIgnore
@IndexedEmbedded
private Collection<Address> addresss;

@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "user_id", referencedColumnName = "id")
@EqualsAndHashCode.Exclude
@ToString.Exclude
@NotNull
@JsonIgnore
private User user;

}

第一次
Hibernate ORMMap:键入“com.代码解码.演示.实体.发布”:路径'. addresss.province.name':失败:- HSEARCH700020:无法在路径'. address'中找到类型'com.codedecode.demo.entity.Posting'上关联的反向端。Hibernate搜索需要此信息以便在修改'com.codedecode.demo.entity.Address'时重新索引'com. codedecode.demo.entity.Posting'。您可以通过定义此关联的反向端来解决此错误,或者使用特定于集成的注解(在Hibernate ORM中为@OneToMany(mappedBy =...))或使用Hibernate Search @AssociationInverseSide注解。或者,如果在修改“com.codedecode.demo.entity.Address”时不需要重新索引“com.codedecode.demo.entity.Posting”,您可以使用@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)禁用自动重新建立索引。路径“.地址.省份”:失败:-HSEARCH 700020:无法在路径'. address'中找到类型'com.codedecode.demo.entity.Posting'上关联的反向端。Hibernate搜索需要此信息以便在修改'com.codedecode.demo.entity.Address'时重新索引'com. codedecode.demo.entity.Posting'。您可以通过定义此关联的反向端来解决此错误,或者使用特定于您的集成的注解(在Hibernate ORM中为@OneToMany(mappedBy =...)),或者使用Hibernate Search @AssociationInverseSide注解。如果在修改“com. codecode.demo.entity.Address”时不需要对“com. codecode.demo.entity.Posting”重新建立索引,则可以使用@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)禁用自动重新建立索引。

y0u0uwnf

y0u0uwnf1#

我有一个错误
您还可以在错误消息中找到解释:
当“com. codecode.demo.entity.Address”被修改时,Hibernate搜索需要此信息来重新索引“com. codecode.demo.entity.Posting”。
和连 * 二 * 方案:
您可以定义此相关的反向端来解决这个错误,方法是使用特定于您的整合的注解(在Hibernate ORM中为@OneToMany(mappedBy =...)),或使用Hibernate Search @AssociationInverseSide注解。
或者,如果在修改“com. codecode.demo.entity.Address”时不需要重新索引“com. codecode.demo.entity.Posting”,则可以使用@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)禁用自动重新索引功能

相关问题