/*I have a table as follows:*/

sqltype sqllen sqlname.data sqlname.length
-------------------- ------ ------------------------------ --------------
492 BIGINT 8 PROMO_ACTION_ID 15
492 BIGINT 8 PROMOTION_ID 12
452 CHARACTER 1 ACTIONTYPE 10
497 INTEGER 4 MIN_ITEM_QUANTITY 17
485 DECIMAL 20, 5 MIN_SINGLE_ITEM_VALUE 21
485 DECIMAL 20, 5 MIN_TOTAL_ITEM_VALUE 20
485 DECIMAL 20, 5 MIN_ORDER_VALUE 15



/*I have the following ResultMap*/

<resultMap id="getPromotionActionMap" class="com.boscovs.commerce.promotion.dao.ActionDAO">
<result property="type" column="actiontype" />
<result property="numberOfItems" column="min_item_quantity" javaType="int"/>
<result property="individualItemValue" column="min_single_item_value" javaType="double"/>
<result property="totalItemValue" column="min_total_item_value" javaType="double"/>
<result property="totalValue" column="min_order_value" javaType="double"/>
</resultMap>



<select id="getPromotionAction" resultMap="getPromotionActionMap"> <![CDATA[Select a.actiontype, a.min_item_quantity, a.min_single_item_value, a.min_total_item_value, a.min_order_value from DB2USR.PROMOTION as p, DB2USR.PROMO_ACTION a where p.promotion_id = a.promotion_id and p.promotion_id = #value# and p.status='A']]> </select>


/*My bean is as follows*/

public class ActionDAO {
public static enum Selected {
UNSELECTED, NO_ACTION, ADDS_X_ITEMS, TOTAL_ORDER_VALUE_AT_LEAST_X
}
private Selected selected = Selected.UNSELECTED;
private XItems xItems;
private double totalValue;
private int numberOfItems;
private double individualItemValue;
private double totalItemValue;
private String type;
/**
* @return
*/
public Selected getSelected() {
return selected;
}


   /**
    * @return
    */
   public double getTotalValue() {
       return totalValue;
   }

   /**
    * @return
    */
   public XItems getXItems() {
       return xItems;
   }

   /**
    * @param i
    */
   public void setSelected(Selected i) {
       selected = i;
   }

   /**
    * @param d
    */
   public void setTotalValue(double d) {
       totalValue = d;
   }

   /**
    * @param items
    */
   public void setXItems(XItems items) {
       xItems = items;
   }

public void setType(String type) {
this.type = type;
}
public double getIndividualItemValue() {
return individualItemValue;
}
public void setIndividualItemValue(double individualItemValue) {
this.individualItemValue = individualItemValue;
}
public int getNumberOfItems() {
return numberOfItems;
}
public void setNumberOfItems(int numberOfItems) {
this.numberOfItems = numberOfItems;
}
public double getTotalItemValue() {
return totalItemValue;
}
public void setTotalItemValue(double totalItemValue) {
this.totalItemValue = totalItemValue;
}
/**
* toString method: creates a String representation of the object
* @return the String representation
* @author
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("ActionDAO[");
buffer.append("individualItemValue = ").append(individualItemValue);
buffer.append(", numberOfItems = ").append(numberOfItems);
buffer.append(", selected = ").append(selected);
buffer.append(", totalItemValue = ").append(totalItemValue);
buffer.append(", totalValue = ").append(totalValue);
buffer.append(", type = ").append(type);
buffer.append(", xItems = ").append(xItems);
buffer.append("]");
return buffer.toString();
}}




/*I get an IllegalArgumentException from all this query. The developers guide infers that you can use primitives in your definitions. Does it? Or am I doing something stupid and not realizing it? BTW, it works if I use Wrapper classes, but I don't want to have to go through all of my beans and covert them. Thanks for any help.*/

Reply via email to