Mybatis中的association級聯查詢

2021-10-25 00:22:45 字數 413 閱讀 1129

pojo中的屬性可能會是乙個物件,我們可以使用聯合查詢,並以級聯屬性的方式封裝物件.使用association標籤定義物件的封裝規則

public class department
public class employee
使用級聯的方式:

select e.id eid, e.last_name, e.email,e.gender ,d.id did, d.dept_name from tbl_employee e , tbl_dept d   where e.d_id = d.id  and e.id = #

association的用法

mybatis中的說明

1.prefix 在trim標籤內sql語句加上字首。suffix 在trim標籤內sql語句加上字尾。suffixoverrides 指定去除多餘的字尾內容,如 suffixoverrides 去除trim標籤內sql語句多餘的字尾 prefixoverrides 指定去除多餘的字首內容 inse...

MyBatis中的快取

mybatis作為持久化框架,提供了非常強大的快取特性。一般在提到mybatis快取的時候,指的都是二級快取。一級快取,即本地快取,缺省會啟用並且不能控制,可能會導致一些難以發現的錯誤。一 一級快取 public void testl1cache finally system.out.println...

Mybatis中的statementType使用

select base column list from finance user new acct where 1 1 andid between and 如果使用了 statementtype statement 的 就不能用了 需要換成 偷笑 update withholding bank c...