try {
resp = coreManager.save(Supplier.class, supp);
}catch (DataIntegrityViolationException dive){
SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-4);
String contraintMsg = dive.getCause().getCause().getMessage();
if(StringUtils.indexOf(contraintMsg, "supplier_id") > 0){
resp1.addError("supplierCode", "Supplier Code Found");
}
return resp1;
} catch (Exception e) {
SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
resp1.addError("exception", e.getMessage());
return resp1;
}
SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);