Bezpośrednie odniesienie do siebie prowadzące do wyjątku cyklu

Mam coś takiego

public abstract class ElasticSearchValue<T> {

  private Long txId;
  private Long currentTxId;
  private T previous;

  public Long getTxId() {
    return txId;
  }

  public void setTxId(Long txId) {
    this.txId = txId;
  }

  public Long getCurrentTxId() {
    return currentTxId;
  }

  public void setCurrentTxId(Long currentTxId) {
    this.currentTxId = currentTxId;
  }

  public Object getPrevious() {
    return previous;
  }

  public void setPrevious(T previous) {
    this.previous = previous;
  }

}

I klasa, która rozszerza klasę powyżej

public class DailyActivity extends ElasticSearchValue<DailyActivity> {

  Long agentId;
  Date date;
  Long success;

  public Long getAgentId() {
    return agentId;
  }

  public void setAgentId(Long agentId) {
    this.agentId = agentId;
  }

  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public Long getSuccess() {
    return success;
  }

  public void setSuccess(Long success) {
    this.success = success;
  }

  @Override
  public String toString() {
    return agentId + "_" + date.toString();
  }

}

Teraz mam obiekt typu DailyActivity i kiedy próbuję go przekonwertować na ciąg json, otrzymuję następujący wyjątek:

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Direct self-reference leading to cycle (through reference chain: com.pr.analysis.DailyActivity["previous"])

Szukałem rozwiązania w google, ale rozwiązanie, które otrzymuję, prosi o umieszczenie jsonIgnore w poprzedniej wartości, co nie jest tym, co zamierzam zrobić. Czy ktoś napotkał ten sam problem? Dzięki

EDYTOWAĆ Wiem, że w klasie jest cykl i pytam, jak deserializować klasę, która ma własny odnośnik?

questionAnswers(5)

yourAnswerToTheQuestion