[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] ManyToOne on non primary keys

Hallo,

we have one problem:

we use OpenJPA implementation and this use case works and we want migrate to EclipseLink but testing on entities

public class Zak {
    @Id
    private int id;

    @Column(name="zak_number")
    private String number;

    @Column(name="zak_year")
    private int year;

    @Column(name="zak_name")
    private String name;

    @ManyToOne
    @JoinColumns({
        @JoinColumn(name="zak_ana", referencedColumnName="ana_number"),
        @JoinColumn(name="zak_year", referencedColumnName="ana_year")
    })
    private Ana ana;

    ...
}


public class Ana { @Id private int id;

    @Column(name="ana_number")
    private String number;

    @Column(name="ana_year")
    private int year;

    @Column(name="ana_name")
    private String name;

    ...
}

failed because EclipseLink noted then Zak used 2 joined columns to mapp Ana but Ana has only one primary key. Tables we can not changed because are from external SW

Supports EclipseLink mapping unidirectional ManyToOne to non pripary keys columns?

Thank's for any answer or help with such mapping.
Zdenek Machac