pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
rs = pstmt.executeQuery ();
while (rs.next ())
{
X_I_Product_Tradename importRecord = new X_I_Product_Tradename (getCtx(), rs, get_TrxName());
X_z_product_tradename actualRecord;
// Check if the tradename already exists in the database. If it does
// Then modify the existing tradename.
sql = new StringBuffer("SELECT * FROM z_product_tradename "
+ "WHERE tradename = ?").append(clientCheck);
try
{
pstmt2 = DB.prepareStatement (sql.toString(), get_TrxName());
pstmt2.setString(1, importRecord.gettradename());
rs2 = pstmt2.executeQuery ();
if (rs2.next())
{
actualRecord = new X_z_product_tradename(getCtx(), rs2, get_TrxName());
}
else
{
actualRecord = new X_z_product_tradename(getCtx(), 0, get_TrxName());
}
}
catch (Exception e)
{
log.log(Level.SEVERE, sql.toString(), e);
actualRecord = new X_z_product_tradename(getCtx(), 0, get_TrxName());
}
finally
{
DB.close(rs2, pstmt2);
}
actualRecord.setM_Product_ID(importRecord.getM_Product_ID());
actualRecord.settradename(importRecord.gettradename());
if (actualRecord.save())
{
importRecord.setI_IsImported(true);
importRecord.setProcessed(true);
if (importRecord.save())