MyBatis SQL Query Implementation Techniques

UNION operations combine results from multiple tables while eliminating duplicate records: <resultMap id="TransactionResult" type="com.example.Transaction"> <id column="txn_id" property="id"/> <result column="order_ref" property="orderReference"/> <result col ...

Posted on Tue, 14 Jul 2026 16:38:23 +0000 by r3dn3ck

Leveraging MyBatis Where and Trim Tags for Robust Dynamic Query Construction

When building dynamic conditional queries in MyBatis, manual WHERE clause construction can introduce syntax errors from leading AND/OR operators or a dagnling WHERE keyword when no filters apply. For example, this flawed query snippet demonstrates both issues: <select id="fetchBlogEntry" resultType="BlogEntity"> SELE ...

Posted on Fri, 12 Jun 2026 16:51:00 +0000 by Mike521

MyBatis Interface Proxy and Advanced Features

Interface Proxy Implementation Proxy Development Approach MyBatis enables DAO layer creation through interface proxies. The framework dynamical generates proxy objects implementing mapper interfaces, eliminating manual DAO implementations. Development Requirements: XML mapper namespace must match the interface's fully qualified name Method nam ...

Posted on Wed, 10 Jun 2026 17:15:56 +0000 by faraco