As stated in the MyBatis manual, there are two implementations of association, nested queries and nested result mappings. As described in the manual, the Select method brings up the problem of n+1 queries, and it is recommended to use nested result mappings for efficiency issues. However, nested result mappings are reported Mapped statements with nested result mapping cannot is safely constrained by R when using Rowbounds for paging Owbounds exception. After testing found that there is a conflict between rowbounds and resultmap-association, fish and bear can not have both, I think it is best to choose to give up rowbounds. After all, you can add variables to the SQL statement to implement paging.
Solution:
< select id = "Selectbyowner" ParameterType = "int" Resultmap = "Topicresultmap" ResultsetType = "Forward_only" >
Select T.tid as Tid, t.uid as Tuid, t.content as content, T.commentcount as Commentcount, t.pptime as Pptime,
U.uid as UID, u.email as email, u.nickname as nickname, U.login as login, u.pass as pass, u.pic as PIC
from topic as T left JOIN user as u on t.uid = U.uid
where t.uid = #{o} limit #{offset},#{limit}
</ select >
#{o} represents the original parameter. This allows the paging task to be handed to the database for completion.
=====================
Or do not rowbounds, direct the offset and pagesize into the DAO, and then add the limit #{offset},#{limit} after SQL
MyBatis Association Table Association and its solutions for common use with rowbounds