mybatis映射XML文件
一个简单的映射文件:
<?xml version="1.0" encoding="UTF-8" ?>
当然这个文件中没有任何的元素
The Mapper XML files have only a few first class elements :
- cache – Configuration of the cache for a given namespace.
- cache-ref – Reference to a cache configuration from another namespace.
- resultMap – The most complicated and powerful element that describes how to load your objects from the database result sets.
- sql – A reusable chunk of SQL that can be referenced by other statements.
- insert – A mapped INSERT statement.
- update – A mapped UPDATE statement.
- delete – A mapped DELETE statement.
- select – A mapped SELECT statement.
select
简单的例子:
select也有很多属性可以让你配置:
select
,
from some_table t1
cross join some_table t2
Result Maps
官网给了个最最复杂的例子
大体意思呢就是一个博客系统有一个作者,很多博文,博文中有一个作者,很多评论,很多标签(包括了一对多,一对一)
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!