问题
Dear fellow programmers,
I am very new to programming and i am following the tutorial on using app engine backend tutorial. However i face some problem along the way.
I have Setup App Engine Backend Application Project, created a CheckIn entity class. After which, i follow the instruction to create a new class with the name CheckInEndPoint.java I copy the code from the snippet over to the Class.
When i try to Generate Cloud Endpoint Class, i faced an error message. Error Generating API This is not a JDO/JPA entity class.
Kindly seek your advice on how to troubleshoot it.
https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial#ecdp
回答1:
The instructions as provided by Google are confusing. What the instructions intended to say is after creating CheckIn.java, right-click on the CheckIn.java file and select Google->Generate Cloud Endpoint Class. This will then automatically create the CheckInEndpoint.java file.
Read through the entire "Entity Design Class Pattern" paragraph as given in the link you provided. You'll recognise that their instructions are ambiguous and is actually meant to be carried out from point 6.
回答2:
Try adding this annotation to your CheckIn class:
import javax.jdo.annotations.PersistenceCapable;
@PersistenceCapable
public class CheckIn ...
This way it will find it as a JDO entity class and it will generate your CheckInEndPoint class.
回答3:
I had the same error, I have first renamed the class CheckInEndPoint I've created manually to avoid any kind of conflicts. After that I have right clicked on
CheckIn class -> Google ->Generate Cloud Endpoint Class.
If you get some dependencies errors, please try check whether all the classes like ApiKeysAndIds.java, UserAccount.java are in the package.
来源:https://stackoverflow.com/questions/20407046/unable-to-generate-cloud-endpoint-class