Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8407615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:24:54+00:00 2026-06-09T23:24:54+00:00

The question may seems stupid, but for me a cycle reference is for example

  • 0

The question may seems stupid, but for me a cycle reference is for example the object A refers an object B AND the object B refers the object A.

I am working with on a android application communicating with a GAE server with objectify DB.

My model is quite simple but I get a error:

org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle (through reference chain: java.util.ArrayList[0]->com.my.model.MyMessage["senderKey"]->com.googlecode.objectify.Key["root"])

Here is my model: a MyMessage refers a MyUser (the MyUser DOESNT refer a MyMessage…

Here is the code:

public class MyMessage implements Serializable {
private static final long serialVersionUID = -1075184303389185795L;

@Id
private Long id;

@Unindexed
private String sendMessage;

@Unindexed
private String answerMessage;

private MessageStatus status = MessageStatus.FREE;

@Parent
Key<MyUser> senderKey;

Key<MyUser> answererKey;

@SuppressWarnings("unused")
private MyMessage() {
}

public MyMessage(MyUser user, String message) {
    super();
    this.sendMessage = message;
    this.senderKey = new Key<MyUser>(MyUser.class, user.getId());
}

[... getters and setters ...]
}

.

public class MyUser implements Serializable {

private static final long serialVersionUID = 7390103290165670089L;
@Id private String id;

@SuppressWarnings("unused")
private MyUser() {
    this.setId("default");
}

public MyUser(String mail) {
    this.setId(mail);
}

public void setId(String mail) {
    this.id = mail;
}

public String getId() {
    return id;
}

}

So what is exactly a Direct self-reference ?? What is wrong with my model??

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:24:55+00:00Added an answer on June 9, 2026 at 11:24 pm

    Key internally contains reference to parent Key, this is type-wise a reference to iteslf, i.e. a direct self-reference. This could potentially lead to endless loop, so Jackson is throwing an error.

    Bottom line: Key is not serializable out-of-the-box. You might get by by writing a custom Jackson serializer/deserializer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm afraid I may be asking a stupid question here, but my google-fu seems
May be this question seems to be stupid, but strangely I find it hard
This may seems like a stupid question for most, but it has been bugging
It may seems to you as a stupid question, but I really can't find
This may seem like a stupid question, but what message do i send to
This may sound like a stupid question but I can't seem to find an
Apologies, my question may be incorrect, but CLIENT_LOCALE seems like the current most-likely culprit:
This question may seem a bit stupid, but i'm new to Joomla! And i
This may seem like a stupid question, but I need to know where the
this may seem like a stupid question, but it is stumping me nontheless. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.