aarush gandhi73
aarush gandhi73

Reputation: 95

JPA doesn't read my updation in columns in my entity class

Let's say I have a entity

@Entity
public class A{
    @Column(name = "a")
    private column a;

    @Column(name = "b")
    private column b;
}

Table is created in database with name A.

Now I want to update columns in my entity

@Entity
public class A{
    @Column(name = "a", length = 1000)
    private column a;

    @Column(name = "b")
    private column b;
}

JPA doesn't read length=1000 in my column a

Any answer would be appreciable

Edit: My config

  jpa:
generate-ddl: true
properties:
  hibernate:
    order_inserts: true
    generate_statistics: false
    jdbc:
      batch_size: 1000
hibernate:
  naming:
    physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
  ddl-auto: update
show-sql: true

Upvotes: 0

Views: 107

Answers (1)

aarush gandhi73
aarush gandhi73

Reputation: 95

!!Answering my own question!!

My configuration :

hibernate.ddl-auto : update

this does not modify the columns and neither delete them from table even after updating the entity.

The correct solution is to do this through migration using flyway

Documentation : https://flywaydb.org/documentation/

We can write native sql queries in the project only and update the length for the column

Upvotes: 1

Related Questions