@Entity(table = "item")
public class Item{
@Id
@GeneratedValue
private Integer id;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "¿aquí qué carajos va?")
private Set<Bid> bids;
}
@Entity(table = "bid")
public class Bid{
@Id
private Integer position;
@Id
@ManyToOne
@JoinColumn(name = "id", nullable = false)
private Item item;
}
mapeo esto?exitfor escribió:Yo no he tocado ésto, pero la respuesta parece ser: depende de cómo lo montes xD
Mirate todo el apartado 7: docs.jboss.org/hibernate/orm/3.6/reference/es-ES/html/collections.html
y éste: mkyong.com/hibernate/hibernate-one-to-many-relationship-example-annotation/

@Entity(table = "item")
public class Item{
@Id
@GeneratedValue
private Integer id;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "id")
private Set<Bid> bids;
}
@Entity(table = "bid")
public class Bid implements Serializable{
@Id
private Integer position;
@Id
@ManyToOne
@JoinColumn(name = "id", nullable = false)
private Item item;
}