I had a problem setting up a one-to-many relationship in my annotated object.
I have the following:
@MappedSuperclass public abstract class MappedModel { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="id",nullable=false,unique=true) private Long mId;
that is
@Entity @Table(name="customer") public class Customer extends MappedModel implements Serializable { private static final long serialVersionUID = -2543425088717298236L; @OneToMany(mappedBy = "customer", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private Collection<Store> stores;
and this one
@Entity @Table(name="store") public class Store extends MappedModel implements Serializable { private static final long serialVersionUID = -9017650847571487336L; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn (name="customer_id",referencedColumnName="id",nullable=false,unique=true) private Customer mCustomer;
what am i doing wrong here
java orm hibernate hibernate-annotations
boyd4715 Oct 25 '10 at 2:14 2010-10-25 02:14
source share