'Spring JPA alter table by creating extra column

I am implementing Spring-JPA application . In the model class I am using @Table annotation to map the table with the model class and against the column name using @column annotation to map a variable to a particular column name in that table. But whenever I am executing the application some extra column has been added to the table. I don't want want that default column name.

Model class:

@Entity
@Table(name="xyz",catalog ="test")
public class ModelTest {
      @Id
      private String cas_Id;
      @Column(name="cas_CaseNumber")
      private String cas_case_number;
      @Column(name="cas_ContactId")
      private String cas_contact_id;
      @Column(name="cas_AccountId")
      private String cas_account_id ;
      @Column(name="cas_OwnerId")
      private String cas_owner_id ;
      private String cas_Type;
      private String cas_Status;
      private String cas_Subject;
      @Column(name="cas_ClosedDate")
      private String cas_closed_date ;
      private String acc_Id;
      private String acc_Name;
      private String acc_Type;
      @Column(name="acc_ParentId")
      private String acc_parent_id ;
      @Column(name="acc_BillingStreet")
      private String acc_billing_street;
      @Column(name="acc_BillingCity")
      private String acc_billing_city;
      @Column(name="acc_BillingState")
      private String acc_billing_state ;
      @Column(name="acc_BillingPostalCode")
      private String acc_billing_postal_code;
      @Column(name="acc_BillingCountry")
      private String acc_billing_country;
      @Column(name="acc_ShippingStreet")  
        private String acc_shipping_street;
//with setter and getter

in the console:

Hibernate: alter table test.xyz add column cas_case_number varchar(255)
Hibernate: alter table test.xyz add column cas_contact_id varchar(255)
Hibernate: alter table test.xyz add column acc_billing_city varchar(255)
Hibernate: alter table test.xyz add column acc_billing_country varchar(255)
Hibernate: alter table test.xyz add column acc_billing_postal_code varchar(255)
Hibernate: alter table test.xyz add column acc_billing_state varchar(255)
Hibernate: alter table test.xyz add column acc_billing_street varchar(255)

I can't understand why this alter table query will executed as I have already those column defined in my entity class.



Solution 1:[1]

Same issue i'm facing in a while.

To solve this issue i've made some changes in my application.properties file,

application.properties

spring.jpa.hibernate.ddl-auto=validate

hope this works for you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ravi Mengar