Jacking serialize TimeStamp to JSON without @JsonSerialize?
<p>I currently store in dates as a type <code>DateTime</code> but the thing is when I make API calls, I return a <code>TimeStamp</code> in my POJO. Since Jackson automatically converts it into milliseconds, I wanted to convert these milliseconds into a <code>Date</code> so it is more human-readable. We use RedShift at work ran into some issues trying to serialize the date using <code>JsonSerialize</code> because the <code>serialize</code> seems to call the wrong <code>serialize</code> method to serialize the JSON, causing some errors when trying to store our data into our Postgres SQL. Is there any way to avoid using <code>JsonSerialize</code> to serialize the <code>TimeStamp</code> to <code>Date</code>? Here was my attempt with <code>JsonSerialize</code></p>

<p>HibernateBaseClass.java</p>

<pre><code>@JsonSerialize(using = CustomDateSerializer.class)
@Basic(optional=false)
@Column(name="created_on")
private Timestamp createdOn;
</code></pre>

<p>CustomDateSerializer.java</p>

<pre><code>public class CustomDateSerializer extends JsonSerializer&lt;Timestamp&gt; {

    private static UserSession userSession = SessionManager.getUserSession();
    public static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    public static final Locale userLocale = new Locale(userSession.getLocale().toString());
    public static final TimeZone userTimeZone = userSession.getTimeZone();

    @Override
    public void serialize(Timestamp timeStamp, JsonGenerator generator, SerializerProvider provider)
        throws IOException, JsonProcessingException {

        if (timeStamp == null) {
            generator.writeNull();
        } else {
            format.setTimeZone(userTimeZone);
            generator.writeString(format.format(timeStamp.getTime()));
        }
    }
    @Override
    public Class&lt;Timestamp&gt; handledType() {
        return Timestamp.class;
    }


    @Override
    public void serializeWithType(Timestamp value, JsonGenerator gen,
                              SerializerProvider serializers, TypeSerializer typeSer)
        throws IOException {
        serialize(value, gen, serializers);
    }
}
</code></pre>

<p>Any help would be appreciated, thanks!</p>