ERROR: type "datetime" does not exist

I'm trying to port my hibernation based application from MySQL to Postgres, but there seems to be a problem with the date format

In my essence, I have

@Entity
@Table( name = "APP_USERS" )
public class User {

    @Id
    @GeneratedValue(generator="increment")
    @GenericGenerator(name="increment", strategy = "increment")
    private int id;

    private String username;
    private String email;
    private String password;
    private String firstname;
    private String lastname;
    private Timestamp joindate;
    ...

but I get an error when creating the table

ERROR: type "datetime" does not exist

sql from "showql"

Hibernate: create table APP_USERS (id integer not null, email varchar(255), firstname varchar(255), joindate datetime, lastname varchar(255), password varchar(255), username varchar(255), primary key (id))

I have installed postgresql-9.5.3-1 locally, and I'm using Hibernate version 5.0.10. Final

Searching for this error on Google gives me very few results.

+4
source share
3 answers

Google "postgresql datetime" PostgreSQL . , DDL, "timestamp", "datetime".

- SQL DDL, , . , , MySQL. PostgreSQL.

+5

now i see that i had

<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>

instead

<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
0
source

Source: https://habr.com/ru/post/1650533/


All Articles