Hi
I've got two columns mapped as my primary key. The values are generated by my application.
When I call entityManager.persist, the insert statement includes one of them but not the other, so I get a 'cant insert null' sort of error.
Here's my class
Code:
@Entity
@Table(name="bulk_account_log")
public class BulkAccountLog {
private Long uploadId;
private Long sequenceNo;
/**
* @return the uploadId
*/
@Id
@Column(name="upload_id")
public Long getUploadId() {
return uploadId;
}
/**
* @param uploadId the uploadId to set
*/
public void setUploadId(Long uploadId) {
this.uploadId = uploadId;
}
/**
* @return the sequenceNo
*/
@Id
public Long getSequenceNo() {
return sequenceNo;
}
/**
* @param sequenceNo the sequenceNo to set
*/
public void setSequenceNo(Long sequenceNo) {
this.sequenceNo = sequenceNo;
}
}
I think it might be something to do with the GenerationType attribute for an ID, but even if it was, I dont understand why one of the columns (sequenceNo) appears in the insert statement, while uploadId doesnt (the only difference is the column mapping.
Any advice appreciated thanks