Spring Boot 2.4.0 java 1.8 thymeleaf 3.0.11 Spring Security 2.4.0 MySQL 8.0.22
I deleted the record that I thought "I don't want" in MySQL Workbench.
You deleted it with Delete row
.
Then I couldn't log in to the system.
It's a record that has nothing to do with the login I was trying to separate.
It's okay if you put it back again, but since there is AutoIncrement,
You can't get it back unless you do something annoying.
I did it before, but I didn't know the solution and couldn't move forward, so for the time being it was annoying, but I did the above method.
But I thought it was unnecessary afterwards, so when I tried to delete it, "See you again ..."
There may be more, so I did a little research.
https://stackoverflow.com/questions/46612968/hibernate-unable-to-find-entity-with-id I referred to this.
@NotFound(action = NotFoundAction.IGNORE)
Apparently I should add this.
@ManyToOne (below)
@Entity
Supplier {
//Field omitted
}
@Entity
Wedding {
//Field omitted
@ManyToOne //← It looks like I'm looking for a record that I erased ...
private Supplier supplier;
}
After change
@Entity
Wedding {
//Field omitted
@ManyToOne
@NotFound(action = NotFoundAction.IGNORE) //← Thanks to this, it seems to ignore me
private Supplier supplier;
}
Still do not know. Why are you looking for the ID of the record you should have deleted? Do you remember it? Where is it stored?
I don't understand.
But it may have been saved somewhere. Is it Hibernate? ??
I don't really understand Spring Boot, but I want to understand it while using it! !!
For the time being, I hope it will be helpful for those who cannot move forward due to the same error.
Recommended Posts