In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Most people do not understand the knowledge points of this article, "what is the mapping relationship between mybatis Plus entity classes and database tables?", so the editor summarizes the following, detailed contents, clear steps, and a certain reference value. I hope you can get something after reading this article. Let's take a look at this article, "what is the mapping relationship between mybatis Plus entity classes and database tables?"
Mapping relationship between entity class and database table
When using mybatisPlus, the mapping between entity classes and data is determined
There are two specific mapping methods.
1. Default: adopt hump mapping rule
For example, the database table for MyUserTable is my_user_table, and the table name for TEMyUserTable is t_e_my_user_table.
2. Note @ TableName
Add @ TableName ("my_user_table") above the class name
Ignore the description of the mapping relationship between an entity class attribute and a database table field
In development, you may encounter MyBatis-Plus using entity class attributes for SQL operations, but you don't need to store them in the database to find them. At this time, we have this attribute in our entities, but there is no such field in the database tables (i.e., entity class attributes are not database table fields). If you don't handle them, you will get an error.
API
@ TableName: related to database tables
@ TableId: table primary key identification
@ TableField: table field identification
@ TableLogic: comments for logical processing of table fields (logical deletion)
Solution
You can use the following comments on entity class attributes when omitting mapping fields:
@ TableField (exist = false): indicates that the property is not a database table field, but must be used.
@ TableField (exist = true): indicates that the attribute is a database table field.
After you add this comment to the attributes of the entity class, this field will not map the database.
@ TableField (exist = false) private Position position; above is the content of this article on "what is the mapping relationship between mybatis Plus entity classes and database tables?". I believe you all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about related knowledge, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.