Using the following:
Oracle JDK 1.8.0._171
Spring boot 1.5.9-RELEASE
Postgresql 9.6
Postgres driver: 42.2.4
Getting the error from following definition:
Table column:
sql
meal_time TIMESTAMP DEFAULT now() NOT NULL
Entity attribute definition:
java
@Column(name = "meal_time", nullable=false)
private Instant mealTime = Instant.now();
Whenever I try to flush or query the entity throws the error:
Caused by: org.postgresql.util.PSQLException: ERROR: column "meal_time" is of type timestamp without time zone but expression is of type bytea
Hint: You will need to rewrite or cast the expression.
I could write a converter for this field but there should be a standard way and it feels like I am missing something as looking around for examples I found very close implementations that actually work.
hibernate-java-8in your dependencies?spring-boot-starter-data-jpa:1.5.9depends onhibernate-core:5.0.12, which did not include support for Java 8's Date and Time API types AFAIK (I think it is included inhibernate-corefor newer Hibernate versions, though)Instantas a TIMESTAMP? You haven't