Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type numeric. When Inserting Into Timestamp column

Viewed 26

I'm trying to insert a timestamp into a column within a PostgreSQL table. I'm getting the exception: "Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type numeric: "2019-10-09 22:17:18+00"". The service is a Spring Boot application using spring-boot-starter-data-rest, spring-boot-starter-data-jpa, org.postgresql jdbc driver, com.fasterxml.jackson.core(Jackson-databind).

public class CrewMember {

    @Id
    @Column(name = "cmseqnumber", length = 10, nullable = false)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_num")
    @SequenceGenerator(name ="seq_num", sequenceName = "seq_num", allocationSize = 1)
    private Long cmSequenceNumber;

    @Column(name = "cmidnumber", length = 10, nullable = false)
    private Long cmIdNumber;

    @Column(name = "cmname", length = 30, nullable = false)
    private String cmName;

    @Column(name = "cmcomment", length = 100, nullable = true)
    private String cmComment;

    @Column(name = "cmnickname", length = 10, nullable = false)
    private String cmNickName;

    @Column(name = "cmhiredate", nullable = true )
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern= "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime cmHireDate;

    @Column(name = "cmcosenioritydate", nullable = true)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime cmCoSeniorityDate;

    @Column(name = "cmpaysenioritydate", nullable = true)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-mm-dd HH:mm:ss")
    private LocalDateTime cmPaySeniorityDate;

    @Column(name = "cmsex", length=1, nullable = false)
    private String cmSex;

    @Column(name = "cmtaxid", length = 15, nullable = false)
    private String cmTaxId;

    @Column(name = "cmcitizenship", length = 3, nullable = true)
    private String cmCitizenship;

    @Column(name = "cmhaswarnings", length = 4, nullable = true)
    private Integer cmHasWarnings;

    @Column(name = "cmneedschecked", length = 4, nullable = true )
    private Integer cmNeedsChecked;

    @Column(name = "cmsnakedate", nullable = true)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime cmSnakeDate;

    @Column(name = "cmsnakeversion", length = 1, nullable = true)
    private String cmSnakeVersion;

    @Column(name = "cmsnakeweek", length=4, nullable = true)
    private Integer cmSnakeWeek;

    @Column(name = "cmprevairlinecode", length = 2, nullable = true)
    private String cmPrevairLineCode;

    @Column(name = "cmlastpsptexpreminderdate", nullable = true)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime cmLastPspTexPreminderDate;

}

Postman Request:

{
    "cmIdNumber": 2230,
    "cmName": "cm name test",
    "cmComment": "test comment",
    "cmNickName": "Tony",
    "cmHireDate": null,
    "cmCoSeniorityDate": null,
    "cmPaySeniorityDate": null,
    "cmBirthDate": null,
    "cmSex": "m",
    "cmTaxId": "XXXXXX1234",
    "cmCitizenship": "US",
    "cmHasWarnings": 0,
    "cmNeedsChecked": 0,
    "cmSnakeDate": null,
    "cmSnakeVersion": "V",
    "cmSnakeWeek": 12,
    "cmPrevairLineCode": "BW",
    "cmLastPspTexPreminderDate": "2019-10-09 22:17:18"
}
0 Answers
Related