Saya menggunakan Pencarian Hibernasi dengan Spring Boot untuk membuat api istirahat yang dapat dicari. Mencoba POST contoh "Pelatihan", saya menerima jejak tumpukan berikut. Tak satu pun dari keduanya sangat berwawasan bagi saya, itulah sebabnya saya mencari bantuan.

Jejak tumpukan: https://pastebin.com/pmurg1N3

Tampak bagi saya bahwa ia mencoba mengindeks entitas nol !? Bagaimana itu bisa terjadi? Ada ide?

Entitas:

@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<>();
0
user3235738 3 Maret 2020, 17:35

1 menjawab

Jawaban Terbaik

Saya akan mengatakan koleksi versions Anda atau koleksi tags Anda berisi objek null, yang umumnya bukan sesuatu yang kami harapkan dalam asosiasi ORM Hibernate, dan tampaknya juga bukan sesuatu yang diharapkan Hibernate Search.

Bisakah Anda memeriksanya dalam mode debug?

1
yrodiere 3 Maret 2020, 15:05