I am using JPA (hibernate) with Postgres database, my hibernate database configuration are as below:
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
properties.setProperty("hibernate.hbm2ddl.auto","validate");
I have a table with property created_by_user_id
CREATE TABLE dppm_main.user_account_profile
( ....//other columns
created_by_user_id integer
)
Mapped to JPA entity as below:
@Column(name = "created_by_user_id")
private Long createdByUserId;
While doing schema validation, I am getting following error:
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column
type encountered in column [created_by_user_id] in table [user_account_profile];
**found [int4 (Types#INTEGER)], but expecting [int8 (Types#BIGINT)]**
How can I fix it? I am having this issue in many places so is it possible to fix it by extending PostgreSQL82Dialect instead of columnDefinition.
bigintbecause your JPA entity usesLong. Try to either useIntegerin the JPA entity orbigintin the table definition.