Hi,
I implemented the following mapping
Code:
public class RMessage {
protected int msgId;
..............................
protected RSubject subject;
protected Integer subjectId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "SUB_ID", updatable = false, insertable = false)
public RSubject getSubject() {
return subject;
}
public void setSubject(RSubject subject) {
this.subject = subject;
}
@Column(name = "SUB_ID", unique = true, nullable = false, precision = 9, scale = 0, updatable = false, insertable = false)
public Integer getSubjectId() {
return subjectId;
}
as you can see I mapped RMessage with the entity RSubject and subjectId (subjectId is the identifier of RSubject) both corresponding to the column SUB_ID, for development convenience.
I think it is not the best way to proceed but is it an error to do it. In other term, would I encounter stacktrace proceeding this way ?
Thanks in advance.