我會解釋情況。我跟着這兩個偉大的政黨成員:父實體Google Cloud API
然而,他們解釋如何爲谷歌雲端點API,具有相互獨立的實體。因此,API類看起來是這樣的:
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)
}
我的問題是:如何創建一個類與另一個父實體?像父母車一樣的實體車輪。我無法與其父實體(使用註釋)建立關係!
我試過,但它似乎沒有工作(外鍵):
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)
}