I'll explain the situation. I followed these two great tuto:
However, they explain how create API for Google Cloud Endpoint, with entities independent from each other. So the API class looks like this:
package com.example.mobileassistant;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* Offer entity.
*/
@Entity
public class Offer {
@Id
private String offerId;
private String title;
private String description;
private String imageUrl;
.... (With Getter and Setter)
}
My question is: How to create a class with a parent entity of another? Like the entitie Wheel, with Parent Car. I can not create a relationship with its parent entity (With the annotation)!
I tried this but it did not seem to work (Foreign Key):
package com.example.mobileassistant;
import javax.jdo.annotations.ForeignKey;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* Offer entity.
*/
@Entity
public class Wheel {
@Id
private String Id;
@ForeignKey
private String parent_id;
private String title;
private String description;
.... (With Getter and Setter)
}