简体   繁体   中英

HSEARCH700020: Unable to find the inverse side of the association on type 'com.codedecode.demo.entity.Posting' at path '.addresss<collection>'

@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;

}

地址.java 省份.java

Hibernate ORM mapping: type 'com.codedecode.demo.entity.Posting': path '.addresss.province.name': failures: - HSEARCH700020: Unable to find the inverse side of the association on type 'com.codedecode.demo.entity.Posting' at path '.addresss'. Hibernate Search needs this information in order to reindex 'com.codedecode.demo.entity.Posting' when 'com.codedecode.demo.entity.Address' is modified. You can solve this error by defining the inverse side of this association, either with annotations specific to your integration (@OneToMany(mappedBy =...) in Hibernate ORM) or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.codedecode.demo.entity.Posting' when 'com.codedecode.demo.entity.Address' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW). path '.addresss.province': failures: - HSEARCH700020: Unable to find the inverse side of the association on type 'com.codedecode.demo.entity.Posting' at path '.addresss'. Hibernate Search needs this information in order to reindex 'com.codedecode.demo.entity.Posting' when 'com.codedecode.demo.entity.Address' is modified. You can solve this error by defining the inverse side of this association, either with annotations specific to your integration (@OneToMany(mappedBy =...) in Hibernate ORM) or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.codedecode.demo.entity.Posting' when 'com.codedecode.demo.entity.Address' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).

I have an error

You also have an explanation, right there in the error message:

Hibernate Search needs this information in order to reindex 'com.codedecode.demo.entity.Posting' when 'com.codedecode.demo.entity.Address' is modified.

And even two solutions:

You can solve this error by defining the inverse side of this association, either with annotations specific to your integration (@OneToMany(mappedBy =...) in Hibernate ORM) or with the Hibernate Search @AssociationInverseSide annotation.

Alternatively, if you do not need to reindex 'com.codedecode.demo.entity.Posting' when 'com.codedecode.demo.entity.Address' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM