cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Мария Григорьева <mags...@gmail.com>
Subject pass repeater to the database using javaflow
Date Fri, 10 Oct 2008 13:19:53 GMT
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?


Mime
View raw message