Sqlmapclient, which is an important interface in Ibatis, involves the execution and batching of SQL mappings.
Now, let's start by understanding its definition of the start of Query method.
The first is the queryForList method:
Specifies the SQL ID, and the result of the execution returns the list
queryForList (java.lang.String ID);
Specifies the ID of the SQL and specifies the number of rows returned
queryForList (java.lang.String ID, int skip, int max);
Specify the ID of the SQL and specify the incoming parameters
queryForList (java.lang.String ID, java.lang.Object parameterobject);
Specify the ID of the SQL, specify the incoming parameters, and then specify the number of rows returned
queryForList (java.lang.String ID, java.lang.Object parameterobject, int skip, int max);
Next is the queryForMap method:
Executes the SQL ID and takes a field in the result as the map key
queryForMap (java.lang.String ID, java.lang.Object parameterobject, java.lang.String keyprop);
As above, and value in map is the specified field, not the entire returned object
queryForMap (java.lang.String ID, java.lang.Object parameterobject, java.lang.String Keyprop, java.lang.String Valueprop);
Again the queryForObject method:
Executes the specified SQL ID and returns an object that will have an exception sqlexception thrown if there are too many functions queried
queryForObject (java.lang.String ID);
Ibid., plus the parameters passed
queryForObject (java.lang.String ID, java.lang.Object parameterobject);
Ibid, and a reference to the returned object that executes
queryForObject (java.lang.String ID, java.lang.Object parameterobject, Java.lang.Object resultobject);
Finally, it is the Queryforpaginatedlist method, which is the method for paging: But this method has been Deprecated , that is, the use of this method is not supported
The two methods return the Paginatedlist interface.
Specifies the SQL ID of the query and prescribes the number of pages per page
Queryforpaginatedlist (java.lang.String ID, int pageSize);
And with the specified parameters.
Queryforpaginatedlist (java.lang.String ID, java.lang.Object parameterobject, int pageSize);
The last one, that is querywithrowhandler, processes each result of the query:
Specify the SQL ID, specify the parameters, and specify the processor
Querywithrowhandler (java.lang.String ID, java.lang.Object parameterobject, Rowhandler Rowhandler);
Specify the SQL ID, specify the processor
Querywithrowhandler (java.lang.String ID, Rowhandler rowhandler);
Now look at this Rowhandler interface.
This interface has only one definition method:handlerRow(java.lang.Object valueObject)
Therefore, we usually implement this interface, because each processing is our own needs.
The incoming property is the object of each row
Note: This article reproduced: http://njupt.iteye.com/blog/320238