Question

I try to store an object of a class which is written by myself using objectify. the class is:

import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;

@Entity
public class Group {

    @Id
    private Long id;
    private String name;
    private List<UserBalance> userBalanceList;

    //getters and setters for all fields
}

the UserBalance class is:

import org.joda.money.BigMoney;
import com.google.appengine.api.users.User;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;

@Entity
public class UserBalance {

    @Id
    private Long id;
    private User user;
    @com.sappenin.objectify.annotation.Money
    private BigMoney money;

    //getters and setters for all fields
}

Now what i get is:

com.googlecode.objectify.SaveException: Error saving mypkg.Group@1325bad7: 
       userBalanceList: mypkg.UserBalance is not a supported property type.
    at com.googlecode.objectify.impl.Transmog.save(Transmog.java:105)
    at ........

i registered the UserBalance class in the objectify service. I used an own OfyService class to register them like described here: https://code.google.com/p/objectify-appengine/wiki/BestPractices#Use_Your_Own_Service

to me it looks like my userBalanceList in the Group class is just a embedded entity like described here: https://code.google.com/p/objectify-appengine/wiki/Entities#Embedding_Entities

when i tried to store an object of UserBalance ont its own (not as part of Group) it works. When i remove the userBalanceList field from the Group class, it works also.

what is wrong? can somebody help me?

Était-ce utile?

La solution

You are trying to use an Objectify v5 object definition with Objectify v4. Make sure you have the correct Objectify jar on your classpath.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top