MyBatis is an open source, lightweight, persistence framework. It automates the mapping between SQL databases and objects in Java. The mappings are decoupled from the application logic by packaging the SQL statements in XML configuration files.
configure the details of the database
|
|
The POJO class
|
|
Mapped Statements
Mapped SQL statements are resided within the element named
|
|
id is unique identifier used to identify the insert statement. On the other hand, parametertype is the class name or the alias of the parameter that will be passed into the statement:
|
|
invoke the ‘insert’ mapped query:
|
|
resultMaps
maps the results of the select queries to the Student class
|
|
The method returns the data of the selected record in the form of List:
|
|