1. 程式人生 > >spring data jpa 關聯設計

spring data jpa 關聯設計

join umt table cto ring pre any collect rate

MAP關聯實體

//    @ElementCollection
@OneToMany(cascade = {CascadeType.ALL})
// @JoinColumn(name = "theme_id")
// @MapKeyEnumerated(EnumType.STRING)
@MapKeyColumn(name="selector")
// @Column(name="block_style_id")
// @JoinColumn(name = "block_style_id")
// @CollectionTable(name="theme_block_style", [email protected]
/* */(name="my_id"))
// @CollectionTable(name="theme_style")
@JoinTable(name = "theme_style")
private Map<String, BlockStyle> style = new HashMap<>();

MAP關聯組件:
    @ElementCollection
// @OneToMany(cascade = {CascadeType.ALL})
// @JoinColumn(name = "theme_id")
// @MapKeyEnumerated(EnumType.STRING)
@MapKeyColumn(name="selector")
// @Column(name="block_style_id")
// @JoinColumn(name = "block_style_id")
// @CollectionTable(name="theme_block_style", [email protected]
/* */(name="my_id"))
@CollectionTable(name="theme_style")
// @JoinTable(name = "theme_style")
private Map<String, BlockStyle> style = new HashMap<>();

spring data jpa 關聯設計