当前位置:网站首页>Error creating bean with name 'entitymanagerfactory' defined in class path

Error creating bean with name 'entitymanagerfactory' defined in class path

2021-01-24 01:01:10 Ambition1246

Share a database primary key when doing a project id The problem of self growth :

In their own use SpringBoot+Vue When you're doing front-end and back-end projects , The new project was too lazy to add a new database

And then we used the previous javaweb A database table of the project

I didn't think too much about creating the database at that time , I should have been used to putting the primary key id Set to self growth , But this watch is id There's no setup

Write javaweb The idea of the project is to add id And so on. It's created manually, and it's not self growing

And then I used springboot There was a problem with the project =-=

Add operation in test There was an error during the test :

Error creating bean with name 'entityManagerFactory' defined in class path

That's the sentence =-= TMD After checking, I found that my primary key is not set to self growth

How to fix it ?

 

Just look for it. It used to be id Set the primary key to self growing database   Right click the database to select data and structure

Similarly, open id It's not a database with self growing primary keys   Right click to select structure only   And then they all open it in Notepad   Will grow from id Copy that line to the database that is not self growing   Then restart ok 了

 

CREATE TABLE `course` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

 

  Here it is id In this form of self growth !

Now that this database has been created Want to modify the primary key id Self growth can only be solved in this way !

Then restart the project for testing : Perfect operation, find data OvO

 

版权声明
本文为[Ambition1246]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/01/20210124005913758p.html

随机推荐