当前位置:网站首页>附加:对于“与数据表对应的实体类“,【面对MongoDB时,使用的@Id等注解】和【以前面对MySQL时,使用的@Id等注解】,是不同的;
附加:对于“与数据表对应的实体类“,【面对MongoDB时,使用的@Id等注解】和【以前面对MySQL时,使用的@Id等注解】,是不同的;
2022-08-04 04:23:00 【小枯林】
说明:
(1)为什么写了本篇博客?:在【60:第五章:开发admin管理服务:13:开发【新增/修改友情链接,接口】;】中,我们为了向MongoDB中插入数据,创建了SaveFriendLinkMO类;然后,这个实体类,使用的注解是【@Id/@Field】注解;
● 然后,发现以前在使用MySQL的时候,我们在mybatis-plus和tkmybatis上使用过这类注解;
● 然后,本篇博客就梳理一下;
(2)声明:本篇博客,并没有什么新的内容;主要目的是,梳理一下,作为一个随时方便回看的锚;
目录
1.Mybatis-Plus【@TableName/@TableId/@TableField】注解;
2.tkmybatis【@Table/@Id/@Column】注解;
二:在面对MongoDB的时候,【@Id/@Field】注解;
一:在面对MySQL的时候,我们在mybatis-plus和tkmybatis上使用过的注解:Mybatis-Plus【@TableName/@TableId/@TableField】注解;tkmybatis【@Table/@Id/@Column】注解;
如有需要,可以参考【附加:Mybatis-Plus【@TableName/@TableId/@TableField】注解;tkmybatis【@Table/@Id/@Column】注解;(这些注解是必需的吗?没写完别看)】中的内容;
1.Mybatis-Plus【@TableName/@TableId/@TableField】注解;
(1)以前,在mybatis-plus的时候,这些与数据表对应的实体类上使用的【@TableName/@TableId/@TableField】注解,然后这些注解是"com.baomidou.mybatisplus.annotation"包下的;
(2)"com.baomidou.mybatisplus.annotation"包;该包是我们引入的mybatis-plus中的包;
2.tkmybatis【@Table/@Id/@Column】注解;
(1)在tkmybatis的时候,这些与数据表对应的实体类上使用的【@Table/@Id/@Column】注解,然后这些注解是"javax.persistence."包下的;
(2)"javax.persistence."包;
● javax包是什么?:可以参考【附加:Java简介(Java SE,Java EE,JDK等);【java.servlet.**】和【javax.**】简介;Eclipse和IDEA在使用servlet-api.jar时的区别;】;
● javax.persistence包:其中的内容是Java SE定义的Java持久化API;(如果有兴趣可以看下其百科【Java持久化API】);即,可以认为这个是java官方定义的;
二:在面对MongoDB的时候,【@Id/@Field】注解;
(1)@Id注解,使用的是"org.springframework.data.annotation"包下的;
(2)"org.springframework.data.annotation"包;(这儿没必要深究,只需要明白这个包是springframework官方定义的就行了;以后有精力了,可以看到spring的源码啥的,再深入了解)
(1)@Field注解,使用的是"org.springframework.data.mongodb.core.mapping"包下的;
(2)"org.springframework.data.mongodb.core.mapping"包,是Spring Boot针对MongoDB而创建的【spring-boot-starter-data-mongodb】中定义的;
边栏推荐
- SQL query String field less than 10 how to check
- 将xml标签转换为txt(voc格式转换为yolo方便进行训练)
- 如何简化现代电子采购的自动化?
- 马尔可夫链
- 【MD5】采用MD5+盐的加密方式完成注册用户和登录账号
- [Skill] Using Sentinel to achieve priority processing of requests
- 结构体指针知识要点总结
- 汇编语言之栈
- [Medical Insurance Science] To maintain the safety of medical insurance funds, we can do this
- 【id类型和NSObject指针 ObjectIve-C中】
猜你喜欢
![[Medical Insurance Science] To maintain the safety of medical insurance funds, we can do this](/img/d0/6ac51d0d51c907ed0e1578e038fffd.jpg)
[Medical Insurance Science] To maintain the safety of medical insurance funds, we can do this

Introduction to mq application scenarios

复现20字符短域名绕过

Gigabit 2 X light 8 electricity management industrial Ethernet switches WEB management - a key Ring Ring net switch

See how DevExpress enriches chart styles and how it empowers fund companies to innovate their business

share总结

Oracle与Postgresql在PLSQL内事务回滚的重大差异

Take care of JVM performance optimization (own note version)

RSS订阅微信公众号初探-feed43

Explain详解与实践
随机推荐
Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology
How to open a CITIC Securities online account?is it safe?
Explain detailed explanation and practice
结构体指针知识要点总结
Implementing a server-side message active push solution based on SSE
自定义通用分页标签01
7-1 LVS+NAT 负载均衡群集,NAT模式部署
if,case,for,while
8. Haproxy builds a web cluster
JVM Notes
XSS related knowledge points
使用serve搭建本地服务器
文件系统的简单操作
移动支付线上线下支付场景
SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropri
base address: environment variable
自定义通用分页标签02
For Qixi Festival, I made a confession envelope with code
drools from download to postman request success
深度学习之 10 卷积神经网络3









