在 Hibernate Search 中编制索引时出错 - 无法获取 属性 值
Error while indexing in Hibernate Search - Could not get property value
我将 Hibernate Search 与 Spring Boot 一起使用来创建可搜索的 rest api。尝试 POST "Training" 的实例时,我收到以下堆栈跟踪。 None 这两个对我来说很有见地,这就是我寻求帮助的原因。
堆栈跟踪:
https://pastebin.com/pmurg1N3
在我看来,它正在尝试索引一个空实体!?怎么会这样?有什么想法吗?
实体:
@Entity @Getter @Setter @NoArgsConstructor
@ToString(onlyExplicitlyIncluded = true)
@Audited @Indexed(index = "Training")
@AnalyzerDef(name = "ngram",
tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class ),
filters = {
@TokenFilterDef(factory = StandardFilterFactory.class),
@TokenFilterDef(factory = LowerCaseFilterFactory.class),
@TokenFilterDef(factory = StopFilterFactory.class),
@TokenFilterDef(factory = NGramFilterFactory.class,
params = {
@Parameter(name = "minGramSize", value = "2"),
}
)
}
)
@Analyzer(definition = "ngram")
public class Training implements BaseEntity<Long>, OwnedEntity {
@Id
@GeneratedValue
@ToString.Include
private Long id;
@NotNull
@RestResourceMapper(context = RestResourceContext.IDENTITY, path = "/companies/{id}")
@JsonProperty(access = Access.WRITE_ONLY)
@JsonDeserialize(using = RestResourceURLSerializer.class)
private Long owner;
@NotNull
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
private String name;
@Column(length = 10000)
private String goals;
@Column(length = 10000)
private String description;
@Enumerated(EnumType.STRING)
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO, bridge=@FieldBridge(impl=EnumBridge.class))
private Audience audience;
@Enumerated(EnumType.STRING)
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO, bridge=@FieldBridge(impl=EnumBridge.class))
private Level level;
@ManyToMany
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@NotNull @Size(min = 1)
@IndexedEmbedded
private Set<ProductVersion> versions;
@NotNull
private Boolean enabled = false;
@NotNull
@Min(1)
@IndexedEmbedded
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO)
@NumericField
private Integer maxStudents;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Agenda agenda;
@NotNull
@Min(1)
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO)
@NumericField
private Integer durationDays;
@IndexedEmbedded
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@ManyToMany(cascade = CascadeType.PERSIST)
private Set<Tag> tags = new HashSet<>();
我会说你的 versions
集合或你的 tags
集合包含 null
对象,这通常不是我们在 Hibernate ORM 关联中期望的东西,而且显然不是什么东西Hibernate Search 需要两者之一。
你能在调试模式下检查吗?
我将 Hibernate Search 与 Spring Boot 一起使用来创建可搜索的 rest api。尝试 POST "Training" 的实例时,我收到以下堆栈跟踪。 None 这两个对我来说很有见地,这就是我寻求帮助的原因。
堆栈跟踪: https://pastebin.com/pmurg1N3
在我看来,它正在尝试索引一个空实体!?怎么会这样?有什么想法吗?
实体:
@Entity @Getter @Setter @NoArgsConstructor
@ToString(onlyExplicitlyIncluded = true)
@Audited @Indexed(index = "Training")
@AnalyzerDef(name = "ngram",
tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class ),
filters = {
@TokenFilterDef(factory = StandardFilterFactory.class),
@TokenFilterDef(factory = LowerCaseFilterFactory.class),
@TokenFilterDef(factory = StopFilterFactory.class),
@TokenFilterDef(factory = NGramFilterFactory.class,
params = {
@Parameter(name = "minGramSize", value = "2"),
}
)
}
)
@Analyzer(definition = "ngram")
public class Training implements BaseEntity<Long>, OwnedEntity {
@Id
@GeneratedValue
@ToString.Include
private Long id;
@NotNull
@RestResourceMapper(context = RestResourceContext.IDENTITY, path = "/companies/{id}")
@JsonProperty(access = Access.WRITE_ONLY)
@JsonDeserialize(using = RestResourceURLSerializer.class)
private Long owner;
@NotNull
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
private String name;
@Column(length = 10000)
private String goals;
@Column(length = 10000)
private String description;
@Enumerated(EnumType.STRING)
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO, bridge=@FieldBridge(impl=EnumBridge.class))
private Audience audience;
@Enumerated(EnumType.STRING)
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO, bridge=@FieldBridge(impl=EnumBridge.class))
private Level level;
@ManyToMany
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@NotNull @Size(min = 1)
@IndexedEmbedded
private Set<ProductVersion> versions;
@NotNull
private Boolean enabled = false;
@NotNull
@Min(1)
@IndexedEmbedded
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO)
@NumericField
private Integer maxStudents;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Agenda agenda;
@NotNull
@Min(1)
@Field(index = Index.YES, store = Store.YES, analyze = Analyze.NO)
@NumericField
private Integer durationDays;
@IndexedEmbedded
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@ManyToMany(cascade = CascadeType.PERSIST)
private Set<Tag> tags = new HashSet<>();
我会说你的 versions
集合或你的 tags
集合包含 null
对象,这通常不是我们在 Hibernate ORM 关联中期望的东西,而且显然不是什么东西Hibernate Search 需要两者之一。
你能在调试模式下检查吗?