Jump to: navigation, search

EclipseLink/Examples/MOXy/JPA/CompoundPrimaryKeys

< EclipseLink‎ | Examples‎ | MOXy‎ | JPA
Revision as of 09:44, 1 December 2009 by Blaise.doughan.oracle.com (Talk | contribs) (New page: <source lang="java"> @Entity public class PhoneNumber { @ManyToOne @JoinColumns({ @JoinColumn(name="E_ID", referencedColumnName = "E_ID"), @JoinColumn(name="E_COUN...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
@Entity
public class PhoneNumber {

    @ManyToOne
    @JoinColumns({
        @JoinColumn(name="E_ID", referencedColumnName = "E_ID"),
        @JoinColumn(name="E_COUNTRY", referencedColumnName = "COUNTRY")
    })
    @XmlIDREF
    private Employee contact;

}
@Entity
public class Employee {

    @Id
    @Column(name="E_ID")
    @XmlID
    private BigDecimal eId;

    @Id
    @XmlID
    private String country;

    @OneToMany(mappedBy="contact")
    @XmlInverseReference(mappedBy="contact")
    private List<PhoneNumber> contactNumber;

}