0

I am using jpa repository.
I want to save an entity in a Mysql table which contains 100000 records.

When I do

FraisProvision fraisProv = new FraisProvision();
...
fraisProvisionRepository.save(fraisProv);

I am getting this error `

Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

It worked well when the mysql table wasn't that big.
If I insert a record in this table via MysqlWorkbench, the record is inserted instantly.
I don't understand why using jpa repository takes so long to insert the entity.

user1260928
  • 3,269
  • 9
  • 59
  • 105

1 Answers1

1

Try adding ?autoReconnect=true to your URI. For example: mysql://db_user:db_user@localhost/mydb?autoReconnect=true It worked for me.

javaboygo
  • 243
  • 2
  • 11