Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use Mapper to add, delete, modify and check the single table

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "using Mapper to add, delete, modify and check a single table". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "use Mapper to add, delete, modify and check a single table".

Need to introduce dependencies in the pom file

Mysql mysql-connector-java runtime tk.mybatis mapper-spring-boot-starter 1.2.3 Org.springframework.boot spring-boot-starter-jdbc

Mode of use:

1. Inherit Mapper in the mapper interface class

Note: normally, when we use mapper.xml to perform an insert operation, we will have the following configuration:

But these are not available in generic mapper, and we need to make additional configuration:

Public class UmsMembers {@ Id @ GeneratedValue (strategy= GenerationType.IDENTITY) / / Primary key return policy? @ Column (name = "id") private String id

Note: replace the previously used mapper scanner

A scanner using tk mapper (generic mapper) is required, otherwise an error that cannot find the generic mmaper method will be reported when the generic mapper method is called

Replace the original mapperscan package

Thank you for your reading, the above is the content of "using Mapper to add, delete, modify and check a single table". After the study of this article, I believe you have a deeper understanding of the problem of using Mapper to add, delete, modify and check a single table, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report