boolean updateStyle = false;
Integer mstProductUniqueid = Integer.parseInt(dbUtils.getMaxId("mst_product_style", "uniqueid", " where productid="+productid+""));
for (int index1 = 0; index1 < dto.getStyle().size(); index1++) {
MstProductStyle mstProductStyle = null,prevMstProductStyle;
updateStyle = false;
if ((!storedProductStyle.isEmpty()) || (!(storedProductStyle.size() < 1))) {
Integer mstProductUniqueid1 = 0;
for (int index2 = 0; index2 < storedProductStyle.size(); index2++) {
Object[] dbdata = storedProductStyle.get(index2);
if (textEncryptDecrypt.decrypt(dto.getStyle().get(index1)).equals(dbdata[0].toString())) {
updateStyle = true;
storedProductStyle.remove("["+dbdata[0]+", "+dbdata[1]+"]");
mstProductUniqueid1 = Integer.parseInt(dbdata[1].toString());
break;
}
}
if (updateStyle) {
// update
System.err.println("DB is Not Empty But Old Record Modification");
//Your Code
} else {
// insert
System.err.println("DB is Not Empty But New Record");
//Your Code
}
} else {
// Insert New Record
System.err.println("DB is Empty So New Record");
//Your Code
}
}
/* entityManager.merge(mstProductStyle); */
transaction.commit();