Hello,
I?m developing an application that uses legacy database. The database has two tables with composite primary keys.
Text table
========
ID_COMPANY ? pk, fk
ID_TEXT - pk
...
EXPERT_DOMAIN_FK
ExpertDomain table
========
ID_COMPANY - pk
EXPERT_DOMAIN ? pk
The Text table has a foreign key to expert table. The foreign key is composed by the fields: ID_COMPANY and EXPERT_DOMAIN_FK. The ID_COMPANY is part of the primary key of Text table. The relation between the Text table and Expert domain table is many to one.
I have a problem with OO relation mapping of TextObject class that concerns ManyToOne mapping to ExpertDomain class.
The TextObject is mapped to Text table
@Entity(access = AccessType.FIELD) @Table(name = "DICT_TEXT") public class TextObject extends BusinessModelingObject { @EmbeddedId protected TextObjectPK pk; ? @ManyToOne @JoinColumns({@JoinColumn(name = "ID_COMPANY", referencedColumnName = "ID_COMPANY", insertable= false, updatable = false), @JoinColumn(name = "EXPERT_DOMAIN_FK", referencedColumnName = "EXPERT_DOMAIN", insertable= false, updatable = false)}) protected DomainObject expertDomain; }