mybatis mapping file mapper
EDITORIAL
The film is still Silicon Valley curriculum resources from education. The following courses are free connection, the teacher is very small, can be used as mybatis comprehensive learning materials
https://ke.qq.com/webcourse/index.html#cid=199779&term_id=100236742&taid=1162819445918819&vid=i1417aduxlz best from the first started watching
Deletions changed parameters and return values
- parameterType can be omitted
- Interface return value can be returned Integer, Long, Boolean, int, long, boolean, void, mybatis has been good for us encapsulates
<insert id="addRow">
</insert>
public Boolean addRow(Elemployee emp);
Get the value of increment primary key
Premise: a database primary key is auto-incremented
mysql
oracle
mybatis parameters
A single parameter
What single parameter may # {}
Multiple parameters
A plurality of parameters, mybatis encapsulated into a frame parameters will map, the value from the map. key to param1, param2 or @Param ( "emp") custom aliases. value is our parameter values
The difference between the $ and #
resultTupe return value
Returns a collection of
resultType write the elements of the collection type Employee
The return value map
Returns a key-value
resultType = map mybatis we already had a map package is an alias for
the result:
Key column name, value is the value
Back plurality of key-value
Id as the key to
the name of the whole class resultType = Employee of
the results:
key value for the id
value for the value of the object Employe
resultMap return value
the result is a custom set resultMap
resultMap is a very important concept, the next section will focus on it