Spring boot integrates mybatis and uses Mysql to realize the primary key UUID

preface

This article mainly introduces the spring boot integration of mybatis and the use of Mysql to realize the primary key UUID, which can be shared for your reference and learning. I won't say much below. Let's take a look at the detailed introduction together.

realization

POM of basic project The XML code is as follows

The specific configuration of mybatis is as follows

The entities are as follows

The following line of code is to solve the problem of exception in spring MVC when the input parameter is of date type

test

The configuration file configures and outputs the SQL log of mybatis

Perform the corresponding insertion operation and observe the console

It can be seen that the query UUID is performed first, and then the insertion operation is performed with the execution result as the inserted primary key

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>