Reputation: 696
i have Entity mapped to table TABLE1 with columns COLUMN1 and COLUMN2
i have class ResViewer
public class ResViewer() {
private boolean flag;
private int property;
...selectors
}
i have entity class
@Entity
@Table(name="TABLE1")
public class Table1() {
@Id
private long id;
private ResViewer res1;
private ResViewer res2;
...selectors
}
How can i map field flag of classes res1 and res2 to columnds COLUMN1 and COLUMN2?
Upvotes: 1
Views: 673
Reputation: 691635
Your ResViewer needs to be annotated with @Embeddable
, and the fields res1 and res2 must be annotated with @Embedded
, and with @AttributeOverrides
, as demonstrated in the javadoc of @Embedded
.
Upvotes: 3