Guest User

Untitled

a guest
Jan 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. @Id private Long listId;
  2. @Parent private Key<User> userKey;
  3. private String name;
  4. private String listPic = "http://localhost/default"; // There must be a default source for pic
  5. private int memberCount;
  6.  
  7. public UserList() {
  8. }
  9.  
  10. public UserList(Key<User> userKey, String name, int memberCount) {
  11. this.userKey = userKey;
  12. this.name = name;
  13. this.memberCount = memberCount;
  14. }
  15.  
  16. public Long getListId() {
  17. return listId;
  18. }
  19.  
  20. public void setListId(Long listId) {
  21. this.listId = listId;
  22. }
  23.  
  24. public Key<User> getUserKey() {
  25. return userKey;
  26. }
  27.  
  28. public void setUserKey(Key<User> userKey) {
  29. this.userKey = userKey;
  30. }
  31.  
  32. public String getName() {
  33. return name;
  34. }
  35.  
  36. public void setName(String name) {
  37. this.name = name;
  38. }
  39.  
  40. public String getListPic() {
  41. return listPic;
  42. }
  43.  
  44. public void setListPic(String listPic) {
  45. this.listPic = listPic;
  46. }
  47.  
  48. public int getMemberCount() {
  49. return memberCount;
  50. }
  51.  
  52. public void setMemberCount(int memberCount) {
  53. this.memberCount = memberCount;
  54. }
  55. }
  56.  
  57. public List<UserList> getUserList(@Named("userId") Long userId){
  58. // Get userList where ancestor is userId
  59. return ofy().load().type(UserList.class).ancestor(Key.create(User.class, userId)).list();
  60. }
  61.  
  62. Caused by: com.fasterxml.jackson.databind.JsonMappingException: Direct self-reference leading to cycle (through reference chain: java.util.HashMap["items"]->$Proxy32[0]->org.octabyte.zeem1.Datastore.UserList["userKey"]->com.googlecode.objectify.Key["root"])
Add Comment
Please, Sign In to add comment