/** * <p>Get HlpInsertUpdate in lazy mode.</p> * @return HlpInsertUpdate - HlpInsertUpdate * @throws Exception - an exception */ public final HlpInsertUpdate lazyGetHlpInsertUpdate() throws Exception { String beanName = getHlpInsertUpdateName(); HlpInsertUpdate hlpInsertUpdate = (HlpInsertUpdate) this.beansMap.get(beanName); if (hlpInsertUpdate == null) { hlpInsertUpdate = new HlpInsertUpdate(); this.beansMap.put(beanName, hlpInsertUpdate); lazyGetLogger().info(null, AFactoryAppBeans.class, beanName + " has been created."); } return hlpInsertUpdate; }
for (Map.Entry<String, Integer> entry : pColumnsVals.getIntegersMap().entrySet()) { if (!(isArrContains(entry.getKey(), pColumnsVals.getIdColumnsNames()) && entry.getValue() == null)) { if (isFirstField) { if (!(isArrContains(entry.getKey(), pColumnsVals.getIdColumnsNames()) && entry.getValue() == null) && !(ISrvOrm.VERSIONOLD_NAME.equals(entry.getKey()))) { if (!(isArrContains(entry.getKey(), pColumnsVals.getIdColumnsNames()) && entry.getValue() == null)) { if (isFirstField) {
final ColumnsValues pColumnsVals) throws Exception { Statement stmt = null; String query = getHlpInsertUpdate().evalSqlInsert(pTable, pColumnsVals); try { if (getLogger().getIsShowDebugMessagesFor(getClass())
/** * <p>Update entity in DB.</p> * @param <T> entity type * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final <T> void updateEntity( final Map<String, Object> pAddParam, final T pEntity) throws Exception { ColumnsValues columnsValues = evalColumnsValues(pAddParam, pEntity); String whereStr = evalWhereForUpdate(pEntity, columnsValues); prepareColumnValuesForUpdate(columnsValues, pEntity); int result = getSrvDatabase().executeUpdate(pEntity.getClass() .getSimpleName().toUpperCase(), columnsValues, whereStr); if (result != 1) { if (result == 0 && columnsValues.ifContains(VERSION_NAME)) { throw new ExceptionWithCode(ISrvDatabase.DIRTY_READ, "dirty_read"); } else { String query = hlpInsertUpdate.evalSqlUpdate(pEntity.getClass() .getSimpleName().toUpperCase(), columnsValues, whereStr); throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE, "It should be 1 row updated but it was " + result + ", query:\n" + query); } } }
String query = getHlpInsertUpdate().evalSqlInsert( pEntity.getClass().getSimpleName().toUpperCase(), columnsValues); recordSet = getSrvDatabase().retrieveRecords(query pEntity.getClass().getSimpleName().toUpperCase(), columnsValues); if (result != 1) { String query = getHlpInsertUpdate().evalSqlInsert(pEntity.getClass() .getSimpleName().toUpperCase(), columnsValues); throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
final String pWhere) throws Exception { Statement stmt = null; String query = getHlpInsertUpdate().evalSqlUpdate(pTable, pColumnsVals, pWhere); try {
.getSimpleName().toUpperCase(), columnsValues); if (result != 1) { String query = getHlpInsertUpdate().evalSqlInsert(pEntity.getClass() .getSimpleName().toUpperCase(), columnsValues); throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
boolean isFirstField = true; for (String key : pColumnsVals.getIntegersMap().keySet()) { if (!isArrContains(key, pColumnsVals.getIdColumnsNames())) { if (isFirstField) { isFirstField = false; if (!isArrContains(key, pColumnsVals.getIdColumnsNames()) && !ISrvOrm.VERSIONOLD_NAME.equals(key)) { if (isFirstField) { if (!isArrContains(key, pColumnsVals.getIdColumnsNames())) { if (isFirstField) { isFirstField = false;
.getSimpleName().toUpperCase(), columnsValues); if (result != 1) { String query = getHlpInsertUpdate().evalSqlInsert(pEntity.getClass() .getSimpleName().toUpperCase(), columnsValues); throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
.getSimpleName().toUpperCase(), columnsValues); if (result != 1) { String query = getHlpInsertUpdate().evalSqlInsert( pEntity.getClass().getSimpleName().toUpperCase(), columnsValues);