package com.querydsl.sql.types;

import java.sql.*;
import java.time.Instant;

import javax.annotation.Nullable;

import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;

/**
 * JSR310InstantType maps {@linkplain java.time.Instant} to
 * {@linkplain java.sql.Timestamp} on the JDBC level
 *
 */
@IgnoreJRERequirement //conditionally included
public class JSR310InstantType extends AbstractJSR310DateTimeType<Instant>  {

    public JSR310InstantType() {
        super(Types.TIMESTAMP);
    }

    public JSR310InstantType(int type) {
        super(type);
    }

    @Override
    public String getLiteral(Instant value) {
        return dateTimeFormatter.format(value);
    }

    @Override
    public Class<Instant> getReturnedClass() {
        return Instant.class;
    }

    @Nullable
    @Override
    public Instant getValue(ResultSet rs, int startIndex) throws SQLException {
        Timestamp timestamp = rs.getTimestamp(startIndex, utc());
        return timestamp != null ? timestamp.toInstant() : null;
    }

    @Override
    public void setValue(PreparedStatement st, int startIndex, Instant value) throws SQLException {
        st.setTimestamp(startIndex, Timestamp.from(value), utc());
    }
}

@@ -70,16 +70,73 @@
 Instant;
+%0Aimport java.time.LocalDateTime;%0Aimport java.time.ZoneId;
 %0A%0Aimport
@@ -718,21 +718,62 @@
 .format(
-value
+LocalDateTime.ofInstant(value, ZoneId.of(%22Z%22))
 );%0A    %7D

Fix formatting of propertyless java.time.Instant