Moment For Technology

MyBatis cache | MyBatis series (10)

MyBatis series summary: MyBatis series preface shock! MyBaits has a cache? Do not know to have fallen behind ~ although in our peacetime development will not use, but understanding is still very necessary! In real work, we use cache 1

Mybatis if test

So there is not enough attention paid to this area. The result is that no matter what value I pass, status=2 is executed in SQL. OgnlOps class isEqual to OgnlOps class isEqual to OgnlOps class isEqual to OgnlOps class isEqual to OgnlOps class isEqual to OgnlOps class isEqual to OgnlOps class isEqual to OgnlOps class

MyBatis creates tables dynamically

The project needs to log interface invocations, and since the number is not large at present, it is decided to create a table dynamically based on years (invoke_interface_LOG_2021). Implement (dynamic SQL) with MyBatis.

Use Mybatis TypeHandler to encrypt and decrypt data

Sometimes, some sensitive information of users will be saved in our database, such as mobile phone number, bank card and other information. If these information is saved in plain text, it is not safe. If a hacker breaks into the database, or a former employee exports the data, sensitive information could be leaked

Mybatis summary

(1).MyBatis is an excellent Java-based persistence layer framework, which encapsulates JDBC internally, so that developers only need to pay attention to THE SQL statement itself, but do not need to spend energy to deal with loading driver, creating connection, creating statement and other complicated process. (2). To configure various statements to be executed by means of XML files or annotations...

A pitting record in Mybatis cache

In order to avoid frequent interaction with the database, Mybatis provides support for caching. In the default case without configuration, it only turns on the level-1 cache, and the level-2 cache needs to be controlled by configuration. Level 1 cache: The level 1 cache is only for the same SQL session. If the parameters of the SqlSesson object are exactly the same as those of the SQL session, the level 1 cache is only for the same SQL session.

Mybatis one-to-many, many-to-one processing

One-to-many: a teacher with multiple students, translated into a programming language is a teacher object under a set of student objects. Many-to-one: When multiple students have the same teacher, there is an attribute in the student object associated with the teacher. Studentmapper. Java defines two query methods based on different implementations. How to write studentMapper.xml

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.