Recommended tutorial: "java Video Article"
What is the paging principle of mybatis?
Mybatis paging principle is:
First, an interceptor interface is defined inside MyBatis
All plug-ins must implement this Interface, let's take a look at the definition of this interface
public interface Interceptor { Object intercept(Invocation invocation) throws Throwable; Object plugin(Object target); void setProperties(Properties properties); }
Then one of the key methods is intercept, so as to achieve interception
The principle of paging plug-in is to use the plug-in interface provided by MyBatis to realize self-interception Define the plug-in, intercept the SQL to be executed in the interception method of the plug-in, and then rewrite the SQL according to the set dialect (dialect) and the set paging parameters, generate SQL with paging statements, and execute the rewritten SQL. To achieve paging
So the principle is still based on the interceptor
Recommended related articles: "mybatis"
The above is the detailed content of What is the paging principle of mybatis?. For more information, please follow other related articles on the PHP Chinese website!