Gson.toJson Stackoverflow error
<p>I am using play framework in java (ebean is my ORM), and I have this class:</p>

<pre><code>@Entity
@Table(name = "reservation")
public class Reservation extends Model implements Validation {
    @Id
    @Column(name = "reservationId", columnDefinition = "BIGINT")
    @GeneratedValue(strategy = GenerationType.AUTO)
    @JsonIgnore
    private long reservationId;
    @Column(name = "restaurantId", columnDefinition = "BIGINT")
    private long restaurantId;
    @Column(name = "dateTime" , columnDefinition = "DATETIME")
    @JsonFormat(pattern = "dd/mm/yyyy HH:mm:ss")
    @Formats.DateTime( pattern = "dd/mm/yyyy HH:mm:ss")
    private Timestamp dateTime;
    @Column(name = "guestCount")
    private int guestCount;
    @Column(length = 300)
    private String note;

    public static Reservation.Finder&lt;String, Reservation&gt; find = new Model.Finder&lt;String, Reservation&gt;(String.class, Reservation.class);
</code></pre>

<p>and I am trying to serialize it using Gson library. I tried to do this </p>

<pre><code>return new Gson().toJson(Reservation.find.where().eq("reservationId", id).findUnique(););
</code></pre>

<p>but I always get this error:</p>

<pre><code>akka.actor.ActorSystemImpl - Uncaught fatal error from thread [application-akka.actor.default-dispatcher-2] shutting down ActorSystem [application]
java.lang.StackOverflowError: null
    at java.text.DateFormatSymbols.initializeData(DateFormatSymbols.java:684) ~[na:1.8.0_71]
    at java.text.DateFormatSymbols.&lt;init&gt;(DateFormatSymbols.java:146) ~[na:1.8.0_71]
    at sun.util.locale.provider.DateFormatSymbolsProviderImpl.getInstance(DateFormatSymbolsProviderImpl.java:85) ~[na:1.8.0_71]
    at java.text.DateFormatSymbols.getProviderInstance(DateFormatSymbols.java:359) ~[na:1.8.0_71]
    at java.text.DateFormatSymbols.getInstance(DateFormatSymbols.java:335) ~[na:1.8.0_71]
    at java.util.Calendar.getDisplayName(Calendar.java:2110) ~[na:1.8.0_71]
    at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:1125) ~[na:1.8.0_71]
    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:966) ~[na:1.8.0_71]
    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936) ~[na:1.8.0_71]
    at java.text.DateFormat.format(DateFormat.java:345) ~[na:1.8.0_71]
    at com.google.gson.internal.bind.DateTypeAdapter.write(DateTypeAdapter.java:83) ~[gson-2.5.jar:na]
    at com.google.gson.internal.bind.DateTypeAdapter.write(DateTypeAdapter.java:41) ~[gson-2.5.jar:na]
    at com.google.gson.internal.bind.TypeAdapters$26$1.write(TypeAdapters.java:607) ~[gson-2.5.jar:na]
    at com.google.gson.internal.bind.TypeAdapters$26$1.write(TypeAdapters.java:600) ~[gson-2.5.jar:na]
</code></pre>

<p>I was reading a lot about this, and I understand that it may be that infinite loop occurs somewhere while serializing the Reservation object, but since the object does not have any relationship to any other class, I don't understand why it happens.</p>