请教 在hibernate框架中 ,导入excel时,bean匹配列值的方法
for(int i = 0;i < rowcount - 1;i++)
{
try {
if( pro.Codering( sheet.getCell(0,i + 1).getContents() ) != null && pro.Codering( sheet.getCell(0,i + 1).getContents() ).length() >= 1 )
{
Exl exl=new Exl();
exl.setTypeid((long)tid);
exl.setValue1(pro.Codering(sheet.getCell(1,i + 1).getContents()));
exl.setValue2(pro.Codering(sheet.getCell(2,i + 1).getContents()));
exl.setValue3(pro.Codering(sheet.getCell(3,i + 1).getContents()));
exl.setValue4(pro.Codering(sheet.getCell(4,i + 1).getContents()));
exl.setValue5(pro.Codering(sheet.getCell(5,i + 1).getContents()));
exl.setValue6(pro.Codering(sheet.getCell(6,i + 1).getContents()));
exl.setValue7(pro.Codering(sheet.getCell(7,i + 1).getContents()));
exl.setValue8(pro.Codering(sheet.getCell(8,i + 1).getContents()));
exl.setValue9(pro.Codering(sheet.getCell(9,i + 1).getContents()));
exl.setValue10(pro.Codering(sheet.getCell(10,i + 1).getContents()));
exl.setValue11(pro.Codering(sheet.getCell(11,i + 1).getContents()));
exl.setValue12(pro.Codering(sheet.getCell(12,i + 1).getContents()));
exl.setValue13(pro.Codering(sheet.getCell(13,i + 1).getContents()));
exl.setValue14(pro.Codering(sheet.getCell(14,i + 1).getContents()));
exlService.svae(exl);
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
this.check("导入失败!");
}
}
功能是可以实现的
但这写法是死的
我想实现的是
让exl自动匹配excel的列值
如这个方法
for(i = 0;i < rowcount - 1;i++)
{
if( pro.Codering( sheet.getCell(0,i + 1).getContents() ) != null && pro.Codering( sheet.getCell(0,i + 1).getContents() ).length() >= 1 )
{
for(j = 0;j < columncount;j++)
{
//
pstmt.setString(j + 1, pro.Codering(sheet.getCell(j,i + 1).getContents()));
}
pstmt.executeUpdate();
}
}
我使用的是hibernate框架,需要bean来匹配列值
请问怎么匹配 --------------------编程问答-------------------- 瞄了一下
都掉底下去了,少少顶上去下
补充:Java , Web 开发