【发布时间】:2013-11-06 04:58:12
【问题描述】:
在 AppEngine 中,我需要一个 entity Diagram,其中包含一个 id、title 和一个可变的元素列表 inner class Box,每个元素都有 id 和 description。
请在下面找到定义。但是,在定义 EntityProxy List getter 和 setter 时:"The type java.util.List<Box> cannot be used here"。
DIAGRAM.java
@Entity
public class Diagram extends DatastoreObject {
public class Box {
private String boxId;
private String description;
public String get_id() {
return boxId;
}
public void set_id(String boxId) {
this.boxId = boxId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Indexed private String diagramId; // Primary key
@Indexed private String title;
@Embedded private List<Box> boxes;
public String get_id() {
return diagramId;
}
public void set_id(String diagramId) {
this.diagramId = diagramId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public void setBoxes(List<Box> boxes) {
this.boxes = boxes
}
public List<Box> getBoxes() {
return boxes;
}
}
DIAGRAMPROXY.java
[...]
List<Box> getBoxes();
void setBoxes(List<Box> boxes);
[...]
【问题讨论】:
-
那不是子类,那是内部类。
-
好点!但问题是一样的。有什么想法吗?
-
也许把它从课堂上拿出来,让它成为一个单独的课堂,看看是否有帮助?
-
已经试过了。同样的错误...
-
也许您需要将其声明为嵌入式类?
标签: java google-app-engine gwt google-cloud-datastore objectify