[jboss-user] [JBoss Seam] - AnnotationException: no persistent id property
cparham
do-not-reply at jboss.com
Sat Feb 24 21:28:06 EST 2007
Hi,
I've created two entity classes and a composite primary key class. I think I have all three coded properly but when I deploy with Seam 1.1.6 I get an exception:
AnnotationException: com.abc.selfEnrollment.RecordDataKey has no persistent id property
I'm sure I doing something silly. Please tell me what. Here are relevant sections from each class:
| @Entity
| @Name("record")
| @Scope(SESSION)
| @Table(name = "record")
| public class Record implements Serializable {
|
| private Long recordId;
| private Long agreementProductId;
| private Date createDate;
| private Date modifiedDate;
| private Date eventDate;
| private Long participantId;
| private Long recordStatusCode;
| private Long appUserId;
| private Collection<RecordData> recordData;
|
| public Record() {
| }
|
| @Id
| @GeneratedValue
| public Long getRecordId() {
| return recordId;
| }
|
| public void setRecordId(Long recordId) {
| this.recordId = recordId;
| }
|
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "record")
| public Collection<RecordData> getRecordData() {
| return recordData;
| }
|
| public void setRecordData(Collection<RecordData> recordDatas) {
| this.recordData = recordDatas;
| }
| ...
| }
|
| @IdClass(com.abc.selfEnrollment.RecordDataKey.class)
| @Entity
| @Name("recordData")
| @Scope(SESSION)
| @Table(name = "record_data")
| public class RecordData implements Serializable {
|
| private Long recordId;
| private Long biomarkerId;
| private Record record;
| private Double value;
| private Long uomId;
|
| public RecordData() {
| }
|
| @Id
| public Long getBiomarkerId() {
| return biomarkerId;
| }
|
| public void setBiomarkerId(Long biomarkerId) {
| this.biomarkerId = biomarkerId;
| }
|
| @Id
| @Column(name = "ORDERID", nullable = false, insertable = false, updatable = false)
| public Long getRecordId() {
| return recordId;
| }
|
| public void setRecordId(Long recordId) {
| this.recordId = recordId;
| }
|
| @ManyToOne
| @JoinColumn(name = "RECORD_ID")
| public Record getRecord() {
| return record;
| }
|
| public void setRecord(Record record) {
| this.record = record;
| }
| ...
| }
|
| public final class RecordDataKey implements Serializable {
|
| public Long recordId;
| public Long biomarkerId;
|
| public RecordDataKey() {
| }
|
| public RecordDataKey(Long orderId, Long itemId) {
| this.recordId = orderId;
| this.biomarkerId = itemId;
| }
|
| public boolean equals(Object otherOb) {
| if (this == otherOb) {
| return true;
| }
| if (!(otherOb instanceof RecordDataKey)) {
| return false;
| }
| RecordDataKey other = (RecordDataKey) otherOb;
| return ((recordId == null ? other.recordId == null : recordId
| .equals(other.recordId)) && (biomarkerId == other.biomarkerId));
| }
|
| public int hashCode() {
| return ((recordId == null ? 0 : recordId.hashCode()) ^ ((int) biomarkerId
| .longValue() >>> 32));
| }
|
| public String toString() {
| return "" + recordId + "-" + biomarkerId;
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021833#4021833
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021833
More information about the jboss-user
mailing list