Hi,
I have a problem with two tables with composite-ids.
First Table:
Second Table:
FirstTablePK(FK)(PK)
SecondTablePK(PK)
Name
I know it's a bad design, but it's used in production and I can't change it.
Now I tried to map that with annotations to classes. The first class is working fine, but I don't know how to map the second class. I used the Embedded-Annotaion, but it doesn't work properly.
Here are my classes
Code:
@Entity
@Table(name="FirstTable")
public class FirstClass implements Serializable{
@Id
@Column(name="FirstTablePK")
@Type(type="integer")
private Integer id;
@Column(name="Name")
@Type(type="string")
private String name;
}
Code:
@Entity
@Table(name="SecondTable)
public class SecondClass implements Serializable{
@Id
private SecondTablePK id;
@Column(name="Name")
@Type(type="string")
private String name;
@Embeddable
public class FilialePK implements Serializable{
private Integer id;
private FirstClass firstClassImpl.
}
}
Now I don't know how to make this working. I searched for some examples in the web but didn't found much...
Does anybody know how to solve this....?
Thanks in advance