Skip to content

Ibatis parameter map trick

November 7, 2013

You can access class members of a parameter class using the ‘.’ –

public class Box {

private int height;

private int width;

private int depth;

private int weight;

private String color;

private String origin;

private String destination;

 

[… getters and setters here…]

}

 

public class StoreBoxParameters {
  private Box box;
  private String locationCode;

  public StoreBoxParameters(Box aBox){
    this.box = aBox;
  }

  [... getters and setters here...]
}

 

<procedure id="store_box" parameterClass="com.rolfje.StoreBoxParameters">
  {call store_box (
    #box.height,jdbcType=NUMERIC,mode=IN#,
    #box.width,jdbcType=NUMERIC,mode=IN#,
    #box.depth,jdbcType=NUMERIC,mode=IN#,
    #box.weight,jdbcType=NUMERIC,mode=IN#,
    #box.color,jdbcType=VARCHAR,mode=IN#,
    #box.origin,jdbcType=VARCHAR,mode=IN#,
    #box.destination,jdbcType=VARCHAR,mode=IN#,
    #locationCode,jdbcType=VARCHAR,mode=OUT#
  )}
</procedure>

 

 

 

http://rolfje.wordpress.com/2010/02/16/ibatis-inline-parameter-maps/

From → Interests

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: