datajpatest无法区分实体视图和常规视图

v6ylcynt  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(404)

我有一个hibernate实体Map到数据库视图。尽管在执行datajpatest的过程中,spring将其视为常规的。因此,我必须显式地向视图添加新的行,就像它是一个常规表一样,而不是实现为视图提供行的表。如何告诉spring这个实体Map到现有视图?
这是视图定义

@Entity
@Table(name = "rule_with_the_latest_snapshot", schema = "mariott_rule")
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class RuleWithTheLatestSnapshotDBView {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "rule_id")
    private Long id;

    @Convert(converter = StageAttributeConverter.class)
    private Stage stage;

    @Column(name = "switch")
    private boolean switched;

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

    private String description;

    @Column(name = "date_add")
    private ZonedDateTime dateRuleCreated;

    @Column(name = "date_update")
    private ZonedDateTime dateRuleUpdated;

    @Column(name = "param_values")
    @Convert(converter = RuleParamValuesAttributeConverter.class)
    private RuleParamValuesValidatedEntity paramValues;

    @ManyToOne(fetch = LAZY)
    @JoinColumn(name = "app_id")
    private App app;

    @ManyToOne(fetch = LAZY)
    @JoinColumn(name = "user_id_who_added")
    private User userWhoCreated;

    @ManyToOne(fetch = LAZY)
    @JoinColumn(name = "user_id_who_updated")
    private User userWhoUpdated;

    @ManyToOne(fetch = LAZY)
    @JoinColumn(name = "rule_type_id")
    private RuleType ruleType;

    @ManyToOne(fetch = LAZY)
    @JoinColumn(name = "snapshot_id")
    private Snapshot snapshot;
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题