Parameter and Result Maps

Harry · 11 Sep 2026 · 9 views

Connecting Columns and Properties

Parameter maps describe how Java objects turn into bind values; result maps describe how result-set columns become Java properties.

Parameter Map

<parameterMap id="customerParam" class="com.example.app.domain.Customer">
  <parameter property="name" jdbcType="VARCHAR"/>
  <parameter property="email" jdbcType="VARCHAR"/>
</parameterMap>

<insert id="insertCustomer" parameterMap="customerParam">
  INSERT INTO customers (name, email) VALUES (?, ?)
</insert>

The statement uses plain ? placeholders and the parameterMap supplies the values in order.

Result Map in Detail

<resultMap id="customerResult" class="com.example.app.domain.Customer">
  <result property="id" column="customer_id" jdbcType="BIGINT"/>
  <result property="name" column="name"/>
  <result property="registrationDate" column="created_at" jdbcType="TIMESTAMP"/>
</resultMap>

column can differ from the Java property; jdbcType guides the driver's conversions for NULLs and types.

Auto-Mapping Fallback

When no resultMap is given, iBATIS tries to match columns to properties by name. Using an explicit resultMap removes all guesswork.

Key Points

  • Result maps translate columns into Java object fields.
  • Parameter maps feed named values into ? placeholders.
  • jdbcType keeps NULLs and conversions predictable.
  • Without a map, iBATIS falls back to property-name matching.
Share this post:

Comments (0)

Please login or register to comment.