First of all I have read the documentation (https://www.datanucleus.org/products/accessplatform_6_0/jdo/mapping.html#compound_identity_1_1_uni), but I did not understand it
The problem
I have class A that has keyA, keyB, keyC as normal fields, but class B has these as primary keys which form a composite key. There are no foreign keys in this relationship. How do I fetch B class by using the fields in class A?
I think JPA has @JoinColumns and @JoinFormula annotations or most likely @PrimaryKeyJoinColumn, but I haven't found anything similar in JDO (DataNucleus)
public class A {
@Persistent
@Column(jdbcType = "VARCHAR", length = 30)
private String keyA;
@Persistent
@Column(jdbcType = "VARCHAR", length = 32)
private String keyB;
@Persistent
@Column(jdbcType = "VARCHAR", length = 30)
private String keyC;
@Persistent
private B b
}
@PersistenceCapable(detachable = "true")
public class B {
@PrimaryKey
@Persistent
@Column(jdbcType = "VARCHAR", length = 30)
private String keyA;
@PrimaryKey
@Persistent
@Column(jdbcType = "VARCHAR", length = 32)
private String keyB;
@PrimaryKey
@Persistent
@Column(jdbcType = "VARCHAR", length = 30)
private String keyC;
@Persistent
@Column(jdbcType = "VARCHAR", length = 30)
private String someDataINeed;
I checked the documentation and searched the web but couldn't find anything similar to what I want