Note that there are some explanatory texts on larger screens.

plurals
  1. POibatis TypeHandlerCallback for multi column mapping - Money object
    primarykey
    data
    text
    <p>Ibatis multi column datamapping to type handler. I have a money object I am using which needs value and currency. How to map multiple columns to same callbacktype handler?</p> <p>Java Money object <a href="http://www.javapractices.com/topic/TopicAction.do?Id=13" rel="nofollow">http://www.javapractices.com/topic/TopicAction.do?Id=13</a></p> <pre><code>public class MoneyTypeHandlerCallBack implements TypeHandlerCallback { //The below works but problems it always defaults currency. I need to be able to get Currency as well to use // new Money(value, currency ) constructor @Override public Object getResult(final ResultGetter getter) throws SQLException { BigDecimal value = getter.getBigDecimal(); if (value == null) { return null; } Money result = new Money(value); // I need to be able to do new Money (value, currency) return result; } ... implment other... } </code></pre> <p>SomeView Bean defination: public class someView implements Serializable{</p> <pre><code>private String companyName private Money netamount; </code></pre> <p>.....geters and setters etc }</p> <p>SQLMAP Configurations:</p> <pre><code>&lt;sqlMap namespace="myspace"&gt; &lt;typeAlias alias="someView" type="com.my.view.someView" /&gt; &lt;resultMap id="some_detail_view" class="someView"&gt; &lt;result property="companyName" column="COMPANY" /&gt; ... &lt;result property="netamount" column="NET_AMT" /&gt; &lt;result property="netamountCurrency" column="NET_AMT_CURRENCY" /&gt; &lt;/resultMap&gt; &lt;select id="someView" parameterClass="java.util.Map" resultClass="someView" resultMap="some_detail_view"&gt; SELECT COMPANY, NET_AMT, NET_AMT_CURRENCY From...... &lt;/select&gt; &lt;/sqlMap&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload