• Explain how mybatis plus does not return a primary key when using insert


    The project is built using springboot. At first, mybatis was used, and then it was upgraded to mybatis plus. According to the introduction of MP’s official website, using MP’s insert method, MP will write the primary key back to the corresponding attribute of the instance for the database table that is added automatically. But in […]

  • Analysis of dynamic SQL statement in mybatis


    This article mainly introduces mybatis in the dynamic SQL statement parsing, the article through the example code introduction is very detailed, to everybody’s study or the work has the certain reference study value, needs the friend may refer to There are two ways to configure SQL in mybatis, one is to use XML to configure, […]

  • Simply understand the principle and example of mybatis interceptor


    This article mainly introduces a simple understanding of the mybatis interceptor implementation principle and examples, the article through the example code is very detailed, for everyone’s study or work has a certain reference learning value, need friends can refer to Routine, first look at some basic concepts: The function of interceptor is that we can […]

  • The implementation of mybatis bulk insert data return primary key


    Response effect (ID is primary key): { “data”: [ {“studentname”: “Zhang San”, “classno”: “class one”, “ID: 111}, {“studentname”: “Li Si”, “classno”: “class 2”, “ID: 112}, {“studentname”: “Wang Wu”, “classno”: “class one”, “ID: 113} ] } Control layer: @PostMapping(“/test”) @ResponseBody public Map<String, Object> test(@RequestBody String data) { Map<String, Object> resultMap = new HashMap<String, Object>(); //Non empty […]

  • Dynamic SQL statement implementation of mybatis


    1. Dynamic SQL < if > tag We use different SQL statements to query according to different values of entity classes. For example, if the ID is not empty, you can query according to the ID. if the username is not empty, you also need to add the user name as a condition. This situation […]

  • Mybatis: an example of how to count the execution time of each SQL


    background Recently, I was often asked about the database affairs in the interview. Maybe I know that I am confused after adding an annotation @ transactional. Now I find that this area is often overlooked. However, interviewers like this view most. It’s not often used, but it’s a very important problem, so that they can […]

  • Timeout of zookeeper request in Dubbo: configuration of mybatis + spring connection to mysql8.0.15


    I’m going to review Java in these two days, So write a shopping mall project with Dubbo to practice, but on the first test of the card, start the provider service and the consumer service, but the request interface always reports the timeout error of the zookeeper request (Dubbo + zookeeper server repeatedly calls three […]

  • Configuration method of SQL statement in mybatis for Oracle


    Hump naming method should be used for underlined fields in the database, such as P ﹣ name corresponding to pname. The example is as follows: 1. SQL statement configuration in XML file (geteway. XML file) <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE mapper PUBLIC “-//mybatis.org//DTD Mapper 3.0//EN” “http://mybatis.org/dtd/mybatis-3-mapper.dtd”> <mapper namespace=”com.soecode.hbdw.gateway.dao.GatewayDao”> <cache></cache> Purpose: to provide SQL statement configuration for […]

  • Custom modification of mybatis generator plug-in


    In order for the front-end engineer to see the annotation description of each entity class attribute in the swagger API document, instead of looking at the data dictionary separately, and to solve the problem of manually adding corresponding annotation to each date format field when receiving and returning data in date format, modify the mybatis […]

  • Project details of building springboot + mybatis + FreeMarker


    Now Java Web projects have been built more by using spring boot. One is that their configuration is simpler. The second is that the popular service architecture, spring cloud, is based on spring boot to implement specific technical details. Mybatis is also our commonly used semi-automatic persistence framework. Today, Xiaobian will lead you to build […]

  • Springboot integrates mybatis Reverse Engineering (detailed version)


    Springboot integrates mybatis Reverse Engineering (detailed version) What reverse engineering Analyze the data table in the database, and automatically generate JavaBean (entity class corresponding to the database table), Dao interface (data access layer interface, which defines the method of accessing data), sqlmap (SQL statement mapping file, one-to-one correspondence with Dao layer interface class) Step1: write […]

  • Wrong foreach data type used by mybatis results in an error


    cause The following error is reported when using mybatis dynamic SQL to traverse conditions: Caused by: java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_item_0’. It was either not specified and/or could not be found for the javaType (com.test.Report) : jdbcType (null) combination. at org.apache.ibatis.mapping.ParameterMapping$Builder.validate (ParameterMapping.java:117) at org.apache.ibatis.mapping.ParameterMapping$Builder.build (ParameterMapping.java:104) at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.buildParameterMapping (SqlSourceBuilder.java:123) at […]