Hibernate - Using java.time.Instant with PostgreSQL -


i schemamanagementexception because of type mismatch. hibernate version 5.2.8.final. hibernate.ddl-auto set validate

org.hibernate.tool.schema.spi.schemamanagementexception: schema-validation: wrong column type encountered in column [end_date] in table [certificate]; found [date (types#date)], expecting [timestamp (types#timestamp)] 

the column entity of type java.time.instant, , postgresql column of type timestamptz.

@column(name = "end_date") private instant enddate; 

for java.time.instant, hibernate type instanttype maps timestamp jdbc type. understand why error says it's expecting types#timestamp. don't understand error says found types#date.

source: https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/hibernate_user_guide.html

one workaround set column definition as

@column(name = "end_date", columndefinition="date") private instant enddate; 

but not convinced it's solution. me instant timestamp, not date.

the workaround not solution. java.time.instant, postgresql column should of type timestamp. mistake in db creation.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -