Prezado thiagotavares.ti, eu dei uma verificada no BD e ele não está como auto_increment.
mas valeu pela ajuda.
public void geraArqImport(WritableSheet sheetDestino, String fileName, String fileMaster, String fileIpi, String filePais) throws BiffException, IOException, RowsExceededException, WriteException, HibernateException, SQLException{
StringBuilder text = new StringBuilder();
List<ProdutoBean> produtosList = new ArrayList<ProdutoBean>() ;
IpiBean ipiBean = new IpiBean();
IpiDao ipiDao = new IpiDao();
updateTextArea2("Carregando arquivo origem...");
String caminhoFile = fileName;
WorkbookSettings ws = new WorkbookSettings();
ws.setEncoding("Cp1252");
Workbook workbookLeituraFile = Workbook.getWorkbook(new File(caminhoFile), ws);
Sheet sheetFile = workbookLeituraFile.getSheet(0);
updateTextArea2("Carregando arquivo Ipi...");
String caminhoIpi = fileIpi;
Workbook workbookLeituraIpi = Workbook.getWorkbook(new File(caminhoIpi));
Sheet sheetIpi = workbookLeituraIpi.getSheet(0);
updateTextArea2("Carregando arquivo pais...");
String caminhoPais = filePais;
Workbook workbookLeituraPais = Workbook.getWorkbook(new File(caminhoPais));
Sheet sheetPais = workbookLeituraPais.getSheet(0);
int linhasFile =sheetFile.getRows();
barra = new Espera (linhasFile);
barra.setCorFundo(Color.DARK_GRAY);
barra.setCorBarra(Color.blue);
barra.setFont("Verdana");
Thread tr = new Thread(barra);
tr.start();
ProdutoDao produtoDao = new ProdutoDao();
ProdutoBean produto = new ProdutoBean();
updateTextArea2("Lendo arquivo origem...");
for(int i = 0; i < linhasFile; i++)
{
if(i==0){
gravar(sheetDestino, "B1_COD",0,i);
gravar(sheetDestino,"B1_DESC",1,i);
gravar(sheetDestino,"B1_TIPO",2,i);
gravar(sheetDestino,"B1_UM",3,i);
gravar(sheetDestino,"B1_LOCPAD",4,i);
gravar(sheetDestino,"B1_SEGUM",5,i);
gravar(sheetDestino,"B1_CONV",6,i);
gravar(sheetDestino,"B1_TIPCONV",7,i);
gravar(sheetDestino,"B1_GRUPO",8,i);
gravar(sheetDestino,"B1_PICM",9,i);
gravar(sheetDestino,"B1_IPI",10,i);
gravar(sheetDestino,"B1_POSIPI",11,i);
gravar(sheetDestino,"B1_ORIGEM",12,i);
gravar(sheetDestino,"B1_CODPAIS",13,i);
gravar(sheetDestino,"B1_CODBAR",14,i);
gravar(sheetDestino,"B1_BITMAP", 15, i);
gravar(sheetDestino,"B1_LOCJAPNB1_PESO", 16, i);
gravar(sheetDestino,"B1_PESO", 17, i);
}
if(i>=4){
String b1Cod = getContents(sheetFile,0, i)==null?"":getContents(sheetFile,0, i);
if(produtoDao.existeProduto(Long.parseLong(b1Cod))==false){
String itfCode;
if(getContents(sheetFile,1, i)==null||getContents(sheetFile,1, i).trim().equals("")){
itfCode="0";
}else{
itfCode=getContents(sheetFile,1, i);
}
String b1Desc = retirarAcentos(getContents(sheetFile,26, i)==null?"":new String(getContents(sheetFile,26, i).getBytes("Cp1252"),"Cp1252")).toUpperCase();
produto.setJanCode(Long.parseLong(b1Cod));
produto.setItfCode(Long.parseLong(itfCode)==0?null:Long.parseLong(itfCode));
produto.setDescricao(b1Desc);
ipiBean.setProdutoBean(produto);
//produtoDao.cadastraProduto((produto));
produtosList.add(produto);
gravar(sheetDestino, b1Cod,0,i-3);
gravar(sheetDestino, b1Desc,1,i-3);
gravar(sheetDestino, b1Tipo,2,i-3);
text.append(b1Cod+";"+b1Desc+";"+b1Tipo+";"+b1Um+";"+b1LocPad+";"+b1SegUm+";"+b1Conv+";"+b1TipoConv+";"+b1Grupo+";"+b1Picm+";"+b1Ipi+";"+b1PosIpi+";"+b1Origem+";");
text.append(b1CodPais+";"+b1CodBar+";"+b1Bitmap+";"+b1LocJapn+";"+b1Peso+";");
text.append(System.getProperty("line.separator") );
}
}
barra.setQtdeProcessado(i);
}
if(text!=null||!text.equals("")){
String texto = text.toString();
updateTextArea2("Gerando arquivo TXT...");
Gravar(texto,"teste");
}
barra.fechar();
tr.interrupt();
if(produtosList.size()!=0){
updateTextArea2("Gravando no BD...");
produtoDao.cadastraListaProduto(produtosList);
}
workbookLeituraFile.close();
workbookLeituraIpi.close();
workbookLeituraPais.close();
if(produtosList.size()!=0){
JOptionPane.showMessageDialog(null,"Arquivo gravado com sucesso!","Concluído",JOptionPane.INFORMATION_MESSAGE);
}else{
JOptionPane.showMessageDialog(null,"Não foi gerado nenhum arquivo, pois não há nenhum produto a ser importado!","Concluído",JOptionPane.INFORMATION_MESSAGE);
}
}