Unable to add new Column and unable to add Foreign Key Constrains

Hii,

I am using
Hibernate Version:5.2.12. Final

1.when I add new Column then it is not reflected in DB.but,
2.once I drop the table from DB, then t column is updated.
3.and every time I run my project then get this log.

Hibernate: alter table ChildGrandChild add constraint FKrgojg76subbenpxsdpfq4lil0 foreign key (SpouseID) references Spouse (SpouseID)
Hibernate: alter table Claim add constraint FKhfw0yf3xxnhwscbbpt89ieri9 foreign key (Address) references Address (AddressID)
Hibernate: alter table Claim add constraint FKateufihryim08ibunarrmq19u foreign key (DeceasedRelative) references DeceasedRelative (DeceasedRelativeID)
Hibernate: alter table Spouse add constraint FKkon6uyviu884hyh7nb63ewvat foreign key (ClaimID) references Claim (ClaimID)
Hibernate: alter table UsersDeviceInfo add constraint FKqqgqlu09yk69xmf73e0a8um1n foreign key (UserID) references Users (UserID)

when I see in MySQL workbench then foreign key is made in Indexes.

my hibernate.properties file is:

jdbc.url = jdbc:mysql://localhost:3306/Dev_ClaaimApp_19-Mar18_Ravi?useLegacyDatetimeCode=false&serverTimezone=Australia/Sydney&useSSL=false
jdbc.username = root
jdbc.password = root
jdbc.driverClassName = com.mysql.cj.jdbc.Driver

#hibernateConfig
hibernate.dialect = org.hibernate.dialect.MySQL5Dialect


hibernate.show_sql = true

hibernate.format_sql = false
hibernate.hbm2ddl= update
hibernate.connection.release_mode = after_statement
hibernate.connection.CharSet = utf-8
hibernate.connection.characterEncoding = utf-8
hibernate.connection.useUnicode = true
http.encoding.charse = UTF-8
http.encoding.enabled = true

First, try upgrading to 5.2.17 and see if it works better.

If it does not work, try providing a replicating test case that proves the issue. You can use this template:

http://in.relation.to/2016/01/14/hibernate-jpa-test-case-template/

So, you need to:

  1. Create an initial script with the previous mapping version.
  2. Supply the entity with a new column

Once you have the test case, open a Jira issue and attach the archived test case folder.

Hii, Valad
I make a demo project with both configuration 5.2.12 and 5.2.17.
my 1’st and 2’d point Work.
but the 3’rd point does not work. it does not create Foreign Key for my Relation.
it creates foreign key constraints as the index in my DB.

Attach it to a Jira issue.

Hi, you remplace of properties

hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

by

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

it’s working for my