Skip to content
Advertisement

Data type is not updating on Database

In my entity class, I want to change the data type of a field but it’s not updating in the database. I am using PostgreSQL. I have also tried adding this:

spring.jpa.hibernate.ddl-auto=update

in application properties and still, it doesn’t work I don’t know why, please help, and thanks.

What I have :

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id // change Integer into Long data type in the database

Advertisement

Answer

If you just created your database and doesn’t have any data in it you can try

spring.jpa.hibernate.ddl-auto=create

update will only update the database rows it won’t alter the table in PostgreSql.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement