当前位置:网站首页>Common technical notes
Common technical notes
2022-06-22 19:32:00 【Algeria GG is learning】
One 、JPA Entity annotations
- @Entity - This is a tag comment , Indicates that this class is an entity , This annotation must be placed on the class name .
- @Table - When the entity class is different from its mapped database table name, you need to use @Table, A common attribute of this annotation is name, Used to indicate the table name of the database .
- @Id - Located in a specific field that holds the persistent identity attribute . This field is considered the primary key in the database .
- @Column - It is used to identify the correspondence between the attributes in the entity class and the fields in the data table
- @GeneratedValue - Generate a unique primary key for the entity class , Provides the primary key generation strategy .

It includes :
- strategy: Primary key generation policy
- generator: key generator
Two 、Jackson
brief introduction
Jackson It is widely used at present , Used to serialize and deserialize json Of Java Open source framework of .
Jackson The community is relatively active , The update speed is also relatively fast , from Github According to the statistics in ,Jackson It's the most popular json One of the parsers .
Spring MVC Default json The parser is Jackson. Jackson There are many advantages .
Jackson The dependent jar Fewer bags , Simple and easy to use .
And others Java Of json Framework Gson Such as compared to , Jackson Analyze the big json Documents are relatively fast ;Jackson It takes up less memory at runtime , Good performance ;
Jackson There are flexible API, It's easy to expand and customize .
Commonly used annotations
- @JsonFormat - When obtaining data from the database and presenting it in the previous paragraph , Use this annotation
- @DataTimeFormat - When the foreground transfers data to the background , Use this annotation
- @JsonInclude - Specify the policy of entity class in serialization
Common attribute values :
- JsonJsonInclude.Include.ALWAYS : This is the default policy , In any case, serialize the field , It's the same effect as not writing this annotation .
- JsonJsonInclude.Include.NON_NULL: This is the most commonly used , That is, if the annotated field is null, Then you won't serialize this field .
- JsonJsonInclude.Include.NON_ABSENT:java There are some complex data structures in , such as AtomicReference or Optional, If a property is of this type , Although this property is not null, But the contents of the package are null Of , The purpose of this annotation is , Only this attribute is not null, And the content of its wrapper will be serialized only if it has value
- JsonJsonInclude.Include.NON_EMPTY: This property contains NON_NULL,NON_ABSENT It also includes that if the field is empty, it will not be serialized . This one is also more commonly used
- JsonJsonInclude.Include.NON_DEFAULT: It's easy to understand , If the field is the default value, it will not be serialized .
3、 ... and 、Mybatis
- @Param - The basic type has parameters that must be added @Param annotation ( Only one can be ignored but it is suggested to add ), among value The attribute value should be consistent with the configuration file parameters .
边栏推荐
- 3GPP 5g R17 standard is frozen, and redcap as an important feature deserves attention!
- Getting started with database connection pooling (c3p0, Druid)
- 插槽里如何判断text为数组
- 实现领域驱动设计 - 使用ABP框架 - 解决方案概览
- mysql数据库设计
- Service practice: use service to complete a download task
- 将一维数据(序列)转化为二维数据(图像)的方法汇总GAFS, MTF, Recurrence plot,STFT
- Intelligent procurement system solution for processing and manufacturing industry: help enterprises realize integrated and Collaborative Procurement in the whole process
- Message Oriented Middleware (I) MQ explanation and comparison of four MQS
- How to manage tasks in note taking software such as flowus and notation?
猜你喜欢

2022 G2 power plant boiler stoker question bank and online simulation examination

JSP connection MySQL total error

How much do you know about the bloom filter and cuckoo filter in redis?

实现领域驱动设计 - 使用ABP框架 - 解决方案概览

上半年,这个领域竟出了7家新独角兽,资本争抢入局

2022 t elevator repair recurrent training question bank and answers

Digital supply chain centralized purchase platform solution for mechanical equipment industry: optimize resource allocation and realize cost reduction and efficiency increase

shell脚本详解(十)——sed编辑器的使用方法

shell脚本详解(二)——条件测试、if语句和case分支语句

数商云:解析B2B2C多用户商城系统架构设计思路,开启智能商城新时代
随机推荐
Digital enabling machinery manufacturing industry, supply chain collaborative management system solution helps enterprises upgrade their supply chain
插槽里如何判断text为数组
给对象赋值
Programmer's tool encyclopedia [continuous update]
ActiveReports报表实战应用教程(十九)——多数据源绑定
5gc and satellite integrated communication scheme
canvas给图片画框框
Makefile does not compile some files
贪心之区间问题(3)
维智科技亮相西部数博会,时空AI技术获高度认可
shell脚本详解(四)——循环语句之while循环和until循环(附加例题及解析)
IPLOOK 成为 RedHat(红帽)业务合作伙伴
[suggestions collection] common usage scenarios of message queue
After reading the hated courage
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
A homekit enabled camera? Zhiting IPC camera IC1 unpacking experience
2022 operation of simulated examination platform for examination question bank of welder (elementary) special operation certificate
Niuke network: minimum coverage substring
2022 t elevator repair recurrent training question bank and answers
Flutter系列-flutter路由管理