Open
Description
Like:
@Entity
@Table
@IdClass(ItemSiteId.class)
public class ItemSite {
@Id
@ManyToOne
private Item item;
@Id
@ManyToOne
private Site site;
public ItemSite() {
}
public ItemSite(Item item, Site site) {
this.item = item;
this.site = site;
}
}
@Entity
@Table
@IdClass(ItemSiteId.class)
public class ItemSite {
@Id
@ManyToOne
private Item item;
@Id
@ManyToOne
private Site site;
public ItemSite() {
}
public ItemSite(Item item, Site site) {
this.item = item;
this.site = site;
}
}
@Entity
@Table
@IdClass(ItemId.class)
public class Item {
@Id
@Column(columnDefinition = "INT")
private Integer id;
@Id
@JoinColumn(name = "manufacturer_id", columnDefinition = "INT")
private Integer manufacturerId;
public Item() {
}
public Item(Integer id, Integer manufacturerId) {
this.id = id;
this.manufacturerId = manufacturerId;
}
public Integer getId() {
return this.id;
}
public Integer getManufacturerId() {
return this.manufacturerId;
}
}
@Entity
@Table
public class Site implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
Integer id;
public Site() {
}
public Site(Integer id) {
this.id = id;
}
public Integer getId() {
return this.id;
}
}
public class ItemSiteId implements Serializable {
private static final long serialVersionUID = 1822540289216799357L;
private ItemId item;
private Integer site;
public ItemSiteId() {
}
public ItemSiteId(ItemId item, Integer site) {
this.item = item;
this.site = site;
}
}