当前位置:网站首页>附加:对于“与数据表对应的实体类“,【面对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】中定义的;
边栏推荐
- 系统设计.如何设计一个秒杀系统(完整版 转)
- Mobile payment online and offline payment scenarios
- 【 observe 】 super fusion: the first mention of "calculate net nine order" evaluation model, build open prosperity of power network
- 【技巧】借助Sentinel实现请求的优先处理
- Introduction and application of go module
- Stop behind.
- 2022软件测试面试题 最新字节跳动50道真题面试题 刷完已拿下15k 附讲解+答疑
- 什么是数字孪生智慧城市应用场景
- 初识Numpy
- Take care of JVM performance optimization (own note version)
猜你喜欢
docker+bridge+redis master-slave+sentry mode
Shell 函数
TL431的基本特性以及振荡电路
"Introduction to nlp + actual combat: Chapter 8: Using Pytorch to realize handwritten digit recognition"
将xml标签转换为txt(voc格式转换为yolo方便进行训练)
Significant differences between Oracle and Postgresql in PLSQL transaction rollback
For Qixi Festival, I made a confession envelope with code
Explain detailed explanation and practice
RSS订阅微信公众号初探-feed43
Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology
随机推荐
if,case,for,while
Mini program + e-commerce, fun new retail
Hangdian Multi-School-Slipper- (tree map conversion + virtual point mapping)
Y86. Chapter iv Prometheus giant monitoring system and the actual combat, Prometheus storage (17)
烧录场景下开发如何进行源代码保密工作
七夕节,我用代码制作了表白信封
pnpm 是凭什么对 npm 和 yarn 降维打击的
自定义通用分页标签01
A Preliminary Study of RSS Subscription to WeChat Official Account-feed43
自定义通用分页标签02
机器学习模型的“可解释性”
The video of machine learning to learn [update]
[Medical Insurance Science] To maintain the safety of medical insurance funds, we can do this
2022支付宝C2C现金红包PHP源码DEMO/兼容苹果/安卓浏览器和扫码形式
How to open a CITIC Securities online account?is it safe?
MySQL query optimization and tuning
如何动态添加script依赖的脚本
SQL interview Questions
复现20字符短域名绕过
移动支付线上线下支付场景