我必須爲學校開發一個Web應用程序,但我有以下問題:我有一個對象具有幾個屬性,其中一個是具有自定義對象的數組列表。然後我使用objectify將對象放入數據存儲區,但是當我檢查gae儀表板數據存儲區查看器時,它具有所有屬性,但不包含數組存儲區。GAE數據存儲:如何存儲自定義對象的數組列表
要給它是如何工作更好的視野: 這是包含數組列表對象:
public class Competentie implements Serializable {
private static final long serialVersionUID = 1L;
@Id Long id;
private String competentie;
List<Stelling> deStellingen = new ArrayList<Stelling>();
public Competentie(String c){
competentie = c;
}
public Competentie(){}
public String getCompetentie(){
return competentie;
}
public void setCompetentie(String c){
competentie = c;
}
public void voegStellingToe(Stelling s){
deStellingen.add(s);
}
public List<Stelling> getStellingen(){
return deStellingen;
}
}
這裏是我如何把它的數據存儲
public void createCompetentie(String comp){
Competentie c = new Competentie(comp);
ofy.put(c);
}
莫非
別人的幫助我在這呢?如果有人需要更多信息,請問。
我不能使用@Embed註釋,因爲我使用的是objectify v3,我必須使用該版本。這個版本也有可能嗎? –
在Objectify v3中,您應該可以使用@Embedded註釋。 – stickfigure
指向v3文檔中@embed的鏈接: https://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#@Embedded – Michael