While integrating spring data JPA with postgres. I have a DB table representing the following java object.
private class A {
@Column(name="createdTime", columnDefiniton="TIMESTAMP WITH TIMEZONE")
OffsetDateTime dateTime;
}
I'm trying to save to this table, however, i am getting
Caused by: org.postgresql.util.PSQLException: ERROR: column "created_time" is of type timestamp with time zone but expression is of type bytea
Hint: You will need to rewrite or cast the expression.
Position: 131
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182) ~[postgresql-9.4-1206-jdbc42.jar:9.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911) ~[postgresql-9.4-1206-jdbc42.jar:9.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173) ~[postgresql-9.4-1206-jdbc42.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:645) ~[postgresql-9.4-1206-jdbc42.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:495) ~[postgresql-9.4-1206-jdbc42.jar:9.4]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:441) ~[postgresql-9.4-1206-jdbc42.jar:9.4]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
I did notice that postgres jdbc jar has 2 versions of AbstractJdbcStatement & AbstractJdbc42Statement. As postgresql-9.4-1206-jdbc42.jar:9.4 supports JDBC 4.2, im assuming calling the wrong class is causing this exception.