datanucleus / datanucleus-rdbms

DataNucleus support for persistence to RDBMS Datastores
30 stars 66 forks source link

Support JPA "MapsId" #17

Open andyjefferson opened 8 years ago

andyjefferson commented 8 years ago

AbstractMemberMetaData has "getMapsIdAttribute" from annotations/XML. Need to make use of it.

Could be useful if fully supporting '@EmbeddedId', for example

@Entity
public class Employee
{
    @Id 
    long id;
}
@Entity
@IdClass(DependentId.class)
public class Dependent
{
    @EmbeddedId
    DependentId id;

    @MapsId("employeePK")
    @ManyToOne 
    Employee employee;
}
@Embeddable
public class DependentId
{
    String name; // matches name of @Id attribute
    long employeePk; // matches type of Employee PK
    ...
}
andyjefferson commented 7 years ago

Note that this is strongly linked to an update to the enhancement contract in https://github.com/datanucleus/datanucleus-core/issues/155