Hello!
I need to pass the repeater params to the database.
Here the function:
public void addRepeater(RepeaterAsList repeater, int compositionID) throws
SQLException {
for (int i=0;i<repeater.size();i++) {
PreparedStatement p_stmt =
con.prepareStatement("insert into component_in_composition(id_composition,
component, amount) " +
"values(?, ?, ?)");
p_stmt.setInt(1,
compositionID);
BigDecimal type =
(BigDecimal) ((RepeaterAsList)
repeater.get(i)).getWidget("type").getValue();
BigDecimal amount =
(BigDecimal) ((RepeaterAsList)
repeater.get(i)).getWidget("amount").getValue();
p_stmt.setBigDecimal(2,
type);
p_stmt.setBigDecimal(3,
amount);
p_stmt.execute();
}
}
But I've got java.lang.ClassCastException!!!!
Please help! How to do it right?