Java GAE数据存储未返回实体
我使用objectify查询了我设置的GAE数据存储,其中至少有一个实体,但我一直得到以下响应Java GAE数据存储未返回实体,java,google-app-engine,google-cloud-datastore,objectify,Java,Google App Engine,Google Cloud Datastore,Objectify,我使用objectify查询了我设置的GAE数据存储,其中至少有一个实体,但我一直得到以下响应 200 OK 显示标题- { “种类”:“调用#resourcesItem”, “etag”:“AiR-q6YO1YYMgAaz-ZfT\u fl7oeY/pcKQAVaDylr\u ZSckRfQAxsphOUU” } 下面是objectify请求的样子 @ApiMethod(name = "queryCalls", path = "queryCalls", httpMethod = Http
200 OK
- 显示标题-
@ApiMethod(name = "queryCalls", path = "queryCalls", httpMethod = HttpMethod.POST)
public List<Call> queryCalls()
{
Query<Call> query = ofy().load().type(Call.class).order("name");
return query.list();
}
}正如您在上一条评论中强调的那样,
@Entity
类必须具有无参数构造函数,以便Objectify能够从数据存储实体构造对象
排序后,您将能够使用类中定义的
@Index
ed属性对结果进行排序。那么,您是说您的查询没有返回结果吗?您需要包括Call
类的相关部分,以帮助其他人理解问题。是的,这就是我要说的,我现在将在编辑中包括Call类。我在Call
类中看不到name
属性。你的意思是patientName
?我尝试添加了patientName,但它给了我一个503错误。你需要查看开发人员控制台中的web应用程序日志,以查看导致错误的原因。然后我如何在不添加arg构造函数的情况下重新创建调用类的构造函数呢???你可以有多个构造函数,但不需要arg-one,这是super-mate。非常感谢你。周末我一直在研究这个问题,但在任何地方都找不到答案,所以非常感谢
package com.cms.log;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
/* Patient Entity */
@Entity
public class Call {
@Id Long callId;
@Index String patientName;
@Index String doctor;
String address1;
String address2;
String address3;
String postCode;
String patientLocation;
@Index String symptoms;
Integer contactNumber;
@Index String callDateTime;
String currentStatus;
public Call(Long callId, String patientName, String doctor, String address1,
String address2, String address3, String postCode, String patientLocation, String symptoms,
Integer contactNumber, String callDateTime, String currentStatus)
{
this.callId = callId;
this.patientName = patientName;
this.doctor = doctor;
this.address1 = address1;
this.address2 = address2;
this.address3 = address3;
this.postCode = postCode;
this.patientLocation = patientLocation;
this.symptoms = symptoms;
this.contactNumber = contactNumber;
this.callDateTime = callDateTime;
this.currentStatus = currentStatus;
};
public Long getCallId() {
return callId;
}
public void setCallId(Long Id) {
this.callId = Id;
}
public String getPatientName() {
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
public String getDoctor() {
return doctor;
}
public void setDoctor(String doctor) {
this.doctor = doctor;
}
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getAddress3() {
return address3;
}
public void setAddress3(String address3) {
this.address3 = address3;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public String getPatientLocation() {
return patientLocation;
}
public void setPatientLocation(String patientLocation) {
this.patientLocation = patientLocation;
}
public String getSymptoms() {
return symptoms;
}
public void setSymptoms(String symptoms) {
this.symptoms = symptoms;
}
public int getContactNumber() {
return contactNumber;
}
public void setContactNumber(int contactNumber) {
this.contactNumber = contactNumber;
}
public String getCallDateTime() {
return callDateTime;
}
public void setCallDateTime(String callDateTime) {
this.callDateTime = callDateTime;
}
public String getCurrentStatus() {
return currentStatus;
}
public void setCurrentStatus(String currentStatus) {
this.currentStatus = currentStatus;
}