ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gustavo Henrique Sberze Ribas" <gri...@cpqd.com.br>
Subject RE: Property/Field resolution order
Date Tue, 08 Sep 2009 14:16:09 GMT
> Does anyone actually care if iBATIS uses getter/setters instead of
fields directly?

  I don't care, as long as it keeps support to java beans
getters/setters or implement some sort of column to method mapping like
Brandon suggested.

  We have a special float point data array stored as a blob in the
database. We then take advantage of iBATIS getters/setters support to do
the conversion. Here's an example:


public class JBean {

   private float[] dataPoints;

   // Used only by iBATIS
   protected byte[] getPointsAsByteStream() {
     // uncanny reconversion
     ...
   }

   // Used only by iBATIS
   protected void setPointsAsByteStream(byte[] points) {
     // uncanny conversion
     ...
   }

   // Used by all others
   public float[] getDataPoints() { return dataPoints; }
   public void setDataPoints(float[] points) { this.dataPoints = points;
}
}

<resultMap class="JBean" id="jbeanResultMap">
    <result property="pointsAsByteStream" column="POINTS"
jdbcType="BLOB" />
</resultMap>


Regards,
Gustavo

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message