如何用ElasticsearchRepository索引Ann Enttie的外键字段?

时间:2019-06-05 03:19:51

标签: jhipster

我的一个索引实体(汽车)对另一个实体(模型)具有外键(模型具有id和name字段)

在Jhipster中是否可以轻松地为Cars编制索引,使其也包含相关Model的字段名称?

public interface CarSearchRepository extends ElasticsearchRepository<Car, Long> {
}

实体。

@Entity
@Table(name = "car")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@org.springframework.data.elasticsearch.annotations.Document(indexName = "car")
public class Car implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @org.springframework.data.elasticsearch.annotations.Field(type = FieldType.Keyword)
    private Long id;

    @NotNull
    @Size(max = 17)
    @Column(name = "vin", length = 17, nullable = false, unique = true)
    private String vin;

    @Column(name = "jhi_year")
    private Instant year;

    @Column(name = "color")
    private String color;

    @Size(max = 128)
    @Column(name = "jhi_comment", length = 128)
    private String comment;

    @ManyToOne
    private Make make;
..
..

0 个答案:

没有答案