I have two entities that have a one to many relationship.The parent entity's primary key is a foreign key in the child entity.These are mapped as shown below in the code snippet:
public abstract class Claimant implements Serializable {
private static final long serialVersionUID = -811235823828480105L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Column(name = "ID")
protected Long id;
@OneToMany(mappedBy="claimant",cascade=CascadeType.ALL,targetEntity=Payee.class)
protected Collection<? extends Payee> payees;
and then in the Payee class :
public abstract class Payee implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Column(name = "ID")
protected Long id;
@ManyToOne
@JoinColumn(name = "CLAIMANT_ID")
private Claimant claimant;
When I persist a Claimant entity , the attached Payee get persisted , but the Claimant entity's primary key is not written to the Payee tables "CLAIMANT_ID" column.
What am missing?
[Message sent by forum member 'jeffmutonho' (jeffmutonho)]
http://forums.java.net/jive/thread.jspa?messageID=212521