0

I create my "App Engine Backend with Google Cloud Messaging" Template, like this one Then i make my entety class Employee. And entety class Manager.

 @Entity

public class Employee {


    @Id
    Long id;
    @Index
    private String regId;

    @Index
    private String email;

    /*
    @Index
    @Load
    Ref <Manager> managerRef;
    */

    @Index
    @Parent
    Key <Manager> managerKey;


    public Employee (){};

    public void setRelationKey(Key<Manager> managerKey){
    this.managerKey = managerKey;
    }

    public Key<Manager> getRelationKey(){
        return managerKey;

    }

    public Long getId(){
        return id;
    }

    public String getRegId() {
        return regId;
    }

    public void setRegId(String regId) {
        this.regId = regId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmai(String email) {
        this.email = email;
    }

}

For work with data it use objectify. So wont groups of employee whith header manager. I put

 `@Index
    @Parent
    Key <Manager> managerKey;` 

in Emplyee. Then i Generate Cloud Endpoint from java class: EmployeeEndpoint and ManagerEndpoint

Then Build -> Deploy Modul to AppEngine

And give BUILD FAILED FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':backend:appengineEndpointsGetClientLibs'.

    There was an error running endpoints command get-client-lib: Parameterized type com.googlecode.objectify.Key < com.example.Operator.myapplication.backend.Manager> not supported.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    My hope for your help.

nnnn
  • 63
  • 2
  • 8

1 Answers1

0

I found solution from this

You will have to annotate your methods with @ApiResourceProperty and set its ignored attribute to true as illustrated in the code below:

 @Entity

public class Employee {

    /** */
    /*
    public static Key<Employee> key(long id) {
        return Key.create(Employee.class, id);
    }
    */
    @Parent
    Key<ManagerManager> managerKey;
    @Id
    Long id;
    @Index
    private String regId;

    @Index
    private String email;

    /*
    @Index
    @Load
    Ref <Manager> managerRef;
    */


    public Employee (){};

    @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
    public void setRelationKey(Key<ManagerManager> managerKey){
    this.managerKey = managerKey;
    }

    @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
    public Key<ManagerManager> getRelationKey(){
        return managerKey;
   ....

And it BUILD SUCCESSFUL

Community
  • 1
  • 1
nnnn
  • 63
  • 2
  • 8