//1.註解實體類型 @OneToMany(targetEntity = ProductBean.class, fetch = FetchType.EAGER) @JoinTable( name = "t_order_product_bean",//關聯表的表名 joinColumns = { @JoinColumn(name = "order_id")//關聯表中約束於這個類的外鍵字段名字 }, inverseJoinColumns = { @JoinColumn(name = "productBean_id")//關聯表中約束於ProductBean的外鍵字段名字 } ) public Set<ProductBean> getProductBeans() { return productBeans; } //2.註解普通數據類型 @ElementCollection(fetch = FetchType.EAGER) @CollectionTable( name = "t_shopping_mall_product_detail_images",//關聯表的表名 joinColumns = { @JoinColumn(name = "product_id")//關聯表中約束於這個類的外鍵字段名字 } ) public Set<String> getDetailImagesURL() { return detailImagesURL; }