Idea uses the MyBatis Generator plug-in to quickly generate code

1. Add in Add the following dependencies to the pom.xml file. Note that this is a plugin <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.4.0</version> </plugin> 2. Write generatorConfig.xml Place th ...

Posted by Benjigga on Tue, 05 May 2020 14:01:18 -0700

Spring verification annotation exception unified processing class

@ControllerAdvice This annotation is the core of unified exception handling Is an Advice that acts on the control layer. This annotation can collect common @ ExceptionHandler, @ InitBinder and @ ModelAttributes methods into one type and apply to all controllers Design ideas in this category: Use the @ ExceptionHandler annotation to c ...

Posted by niekos on Tue, 05 May 2020 12:04:34 -0700

Spring propagation mechanism-Propagation.REQUIRED

Most of the statements on the Internet are "if there is a transaction, the current transaction is supported.". Open if no transaction " It's just a silly face... My understanding at the beginning is that if the save method is called, a transaction will be opened when the transaction is executed to userMapper.save. At this time ...

Posted by drakkon on Tue, 05 May 2020 11:53:30 -0700

Love! Share a spring boot based API, restful API project seed (skeleton)

Preface Recently, I have used Spring Boot with MyBatis, general Mapper plug-in and PageHelper paging plug-in to do several small and medium-sized API projects. I feel that it is very comfortable to develop this project with this set of framework and tools, and the team's response is also good. In the process of project construction and develop ...

Posted by northk on Tue, 05 May 2020 03:08:29 -0700

[mybatis xml] data layer framework application -- one of Mybatis relationship mapping to one

In the actual development, the operation of database often involves multiple tables, which involves the relationship between objects in object-oriented. For multi table operations, MyBatis provides association mapping. Through association mapping, the association relationship between objects can be well handled. Catalog What y ...

Posted by coollog on Mon, 04 May 2020 14:23:40 -0700

Using mybatis to dynamically load external sql

background I don't know if there is such a puzzle in your company. Many departments often ask your department to provide interfaces to query some data. The interface basically has no business logic. An SQL is enough, but it takes time and effort to develop an interface for this SQL. Many people also want to solve it. For example, they often wri ...

Posted by snake310 on Sun, 03 May 2020 14:14:16 -0700

MyBatis and Oracle,MySql,SqlServer insert data return primary key method

MyBatis and Oracle,MySql,SqlServer insert data return primary key method MyBatis Oracle MySql SqlServer insert return primary key MyBatis returns an auto increasing primary key when insert ing data. It can be realized through XML configuration, while different configurations of database are different. Let's take a lo ...

Posted by kef on Sun, 03 May 2020 10:14:58 -0700

How to implement search function in Java?

First of all, we need to make it clear that the search box sends a Get request based on keywords, and sends a Get request to the current page //The sample code request path is the current page path "/ product" <! -- search box get requests to search based on the keywords of the product name -- > <form action="/product" class ...

Posted by suthen_cowgirl on Sun, 03 May 2020 09:39:08 -0700

The use of method handle in Java 7

Before JDK6, we used java reflection to implement dynamic method calls. Most frameworks use more reflection, such as mybatis, spring, etc. In JDK7, java.lang.invoke.MethodHandle (method handle) is added, which is called "modern reflection". In fact, reflection and java.lang.invoke.MethodHandle are both indirect ways to call methods, b ...

Posted by MikeA on Sun, 03 May 2020 06:05:52 -0700

The use of mybatis plus code generator

Code generator MyBatis plus (MP for short) is an enhancement tool of MyBatis. Based on MyBatis, only enhancements are made and no changes are made to simplify development and improve efficiency. Step demo 1, Add mybatis plus dependency <!--spring-boot web--> <dependency> <groupId>org.springfram ...

Posted by luddeb on Sun, 03 May 2020 02:26:54 -0700