Hibernate version: 3
Hi,
Code:
@Entity
public class Person implements Serializable {
private long uid;
// ...
@Id
public long getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
// ...
}
@Entity
@IdClass(PersonInfoId.class)
public class PersonInfo implements Serializable {
private Person person;
private String fieldName;
private String value;
@Id
@ManyToOne
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person= person;
}
@Id
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName= fieldName;
}
//...
}
@Embeddable
public class PersonInfoId implements Serializable {
private Person person;
private String fieldName;
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person= person;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName= fieldName;
}
// override equals/hashCode
}
When I'm trying to query:
from PersonInfo pi where pi.person.uid = :uid
I get an error saying that property uid in PersonInfo cannot be found.
Am I doing something wrong with mappings?
Thanks,
P.