public static AppMessageStoreDao store( BlgDataSourceConfig blg_ds, AppMessageStoreDao ObjToStore) { if (ObjToStore == null) { return null; } try (Connection connection = blg_ds.getConnection()) { String query = "INSERT INTO " + TABLE_NAME + " (" + GUID_STORE + "," // 01 + TRIGGER_KEY + "," // 02 + TXN_TYPE + "," // 03 + PRIORITY + "," // 04 + LOCAL_LOGIN_GUID + "," // 05 + LOCAL_MESSAGE_TIME + "," // 06 + LOCAL_CREATED_TIME + "," // 07 + LOCAL_UPDATED_TIME + "," // 08 + LOCAL_DELETED_TIME + "," // 09 + LOCAL_STATUS + "," // 10 + REMOTE_DEVICE_ID + "," // 11 + REMOTE_USER_GUID + "," // 12 + REMOTE_USER_ID + "," // 13 + REMOTE_MESSAGE_GUID + "," // 14 + REMOTE_CREATED_TIME + "," // 15 + REMOTE_DOCUMENT_ID + "," // 16 + DOCUMENT_JSON + "," // 17 + REMARKS + "," // 18 + STATUS + "," // 19 + REMOTE_USER_PROFILE_JSON + "," // 20 + CODE + "," // 21 + NAME + "," // 22 + DESCR + "," // 23 + LOCAL_DEVICE_URL + "," // 24 + REMOTE_DEVICE_URL + "," // 25 + REFERENCE_NUMBER + "," // 26 + REMOTE_DB_NAME + "," // 27 + LOCAL_DB_NAME + "," // 28 + REMOTE_TABLE_NAME + "," // 29 + LOCAL_TABLE_NAME + "," // 30 + LOCAL_DOCUMENT_ID + ")" // 31 + " VALUES (" + "→" + GUID_STORE + "," // 01 + "→" + TRIGGER_KEY + "," // 02 + "→" + TXN_TYPE + "," // 03 + "→" + PRIORITY + "," // 04 + "→" + LOCAL_LOGIN_GUID + "," // 05 + "→" + LOCAL_MESSAGE_TIME + "," // 06 + "→" + LOCAL_CREATED_TIME + "," // 07 + "→" + LOCAL_UPDATED_TIME + "," // 08 + "→" + LOCAL_DELETED_TIME + "," // 09 + "→" + LOCAL_STATUS + "," // 10 + "→" + REMOTE_DEVICE_ID + "," // 11 + "→" + REMOTE_USER_GUID + "," // 12 + "→" + REMOTE_USER_ID + "," // 13 + "→" + REMOTE_MESSAGE_GUID + "," // 14 + "→" + REMOTE_CREATED_TIME + "," // 15 + "→" + REMOTE_DOCUMENT_ID + "," // 16 + "→" + DOCUMENT_JSON + "," // 17 + "→" + REMARKS + "," // 18 + "→" + STATUS + "," // 19 + "→" + REMOTE_USER_PROFILE_JSON + "," // 20 + "→" + CODE + "," // 21 + "→" + NAME + "," // 22 + "→" + DESCR + "," // 23 + "→" + LOCAL_DEVICE_URL + "," // 24 + "→" + REMOTE_DEVICE_URL + "," // 25 + "→" + REFERENCE_NUMBER + "," // 26 + "→" + REMOTE_DB_NAME + "," // 27 + "→" + LOCAL_DB_NAME + "," // 28 + "→" + REMOTE_TABLE_NAME + "," // 29 + "→" + LOCAL_TABLE_NAME + "," // 30 + "→" + LOCAL_DOCUMENT_ID + ")"; // 31 NamedParameterStatement stmt = new NamedParameterStatement(connection, query); int i = 0; stmt.setString(GUID_STORE, ObjToStore.getGuid_store()); // 1 stmt.setString(TRIGGER_KEY, ObjToStore.getTrigger_key()); // 2 stmt.setString(TXN_TYPE, ObjToStore.getTxn_type()); // 3 stmt.setInt(PRIORITY, ObjToStore.getPriority()); // 4 stmt.setString(LOCAL_LOGIN_GUID, ObjToStore.getLocal_login_guid()); // 5 stmt.setTimestamp(LOCAL_MESSAGE_TIME, ObjToStore.getLocal_message_time()); // 6 stmt.setTimestamp(LOCAL_CREATED_TIME, ObjToStore.getLocal_created_time()); // 7 stmt.setTimestamp(LOCAL_UPDATED_TIME, ObjToStore.getLocal_updated_time()); // 8 stmt.setTimestamp(LOCAL_DELETED_TIME, ObjToStore.getLocal_deleted_time()); // 9 stmt.setString(LOCAL_STATUS, ObjToStore.getLocal_status()); // 10 stmt.setString(REMOTE_DEVICE_ID, ObjToStore.getRemote_device_id()); // 11 stmt.setString(REMOTE_USER_GUID, ObjToStore.getRemote_user_guid()); // 12 stmt.setString(REMOTE_USER_ID, ObjToStore.getRemote_user_id()); // 13 stmt.setString(REMOTE_MESSAGE_GUID, ObjToStore.getRemote_message_guid()); // 14 stmt.setTimestamp(REMOTE_CREATED_TIME, ObjToStore.getRemote_created_time()); // 15 stmt.setString(REMOTE_DOCUMENT_ID, ObjToStore.getRemote_document_id()); // 16 stmt.setString(DOCUMENT_JSON, new Gson().toJson(ObjToStore.getDocument_json())); // 17 stmt.setString(REMARKS, ObjToStore.getRemarks()); // 18 stmt.setString(STATUS, ObjToStore.getStatus()); // 19 stmt.setString(REMOTE_USER_PROFILE_JSON, ObjToStore.getRemote_user_profile_json()); // 20 stmt.setString(CODE, ObjToStore.getCode()); // 21 stmt.setString(NAME, ObjToStore.getName()); // 22 stmt.setString(DESCR, ObjToStore.getDescr()); // 23 stmt.setString(LOCAL_DEVICE_URL, ObjToStore.getLocal_device_url()); // 24 stmt.setString(REMOTE_DEVICE_URL, ObjToStore.getRemote_device_url()); // 25 stmt.setString(REFERENCE_NUMBER, ObjToStore.getReference_number()); // 26 stmt.setString(REMOTE_DB_NAME, ObjToStore.getRemote_db_name()); // 27 stmt.setString(LOCAL_DB_NAME, ObjToStore.getLocal_db_name()); // 28 stmt.setString(REMOTE_TABLE_NAME, ObjToStore.getRemote_table_name()); // 39 stmt.setString(LOCAL_TABLE_NAME, ObjToStore.getLocal_table_name()); // 30 stmt.setString(LOCAL_DOCUMENT_ID, ObjToStore.getLocal_document_id()); // 31 stmt.executeUpdate(); } catch (Exception ex) { ex.printStackTrace(); } return getObject(blg_ds, ObjToStore.getGuid_store()); }
public static GenericDocumentJournalLineDao store( BlgDataSourceConfig blgDsFactory, GenericDocumentJournalLineDao ObjToStore) { if (ObjToStore == null) { return null; } try (Connection connection = blgDsFactory.getConnection()) { String query = "INSERT INTO " + GenericDocumentJournalLineDao.TABLE_NAME + " VALUES(→guid,→guid_doc_hdr,→guid_doc_line,→guid_glcode,→descr,→remarks,→amount_debit,→amount_credit,→comp_guid,→branch_txn_guid,→store_guid,→profit_center_guid,→segment_guid,→project_guid,→dimension_guid,→position_id,→date_txn,→log_json::jsonb,→status,→reference_num,→tx_type)"; NamedParameterStatement stmt = new NamedParameterStatement(connection, query); stmt.setString("guid", ObjToStore.getGuid()); stmt.setString("guid_doc_hdr", ObjToStore.getGuid_doc_hdr()); stmt.setString("guid_doc_line", ObjToStore.getGuid_doc_line()); stmt.setString("guid_glcode", ObjToStore.getGuid_glcode()); stmt.setString("descr", ObjToStore.getDescr()); stmt.setString("remarks", ObjToStore.getRemarks()); stmt.setBigDecimal("amount_debit", ObjToStore.getAmount_debit()); stmt.setBigDecimal("amount_credit", ObjToStore.getAmount_credit()); stmt.setString("comp_guid", ObjToStore.getComp_guid()); stmt.setString("branch_txn_guid", ObjToStore.getBranch_txn_guid()); stmt.setString("store_guid", ObjToStore.getStore_guid()); stmt.setString("profit_center_guid", ObjToStore.getProfit_center_guid()); stmt.setString("segment_guid", ObjToStore.getSegment_guid()); stmt.setString("project_guid", ObjToStore.getProject_guid()); stmt.setString("dimension_guid", ObjToStore.getDimension_guid()); stmt.setString("position_id", ObjToStore.getPosition_id()); stmt.setTimestamp("date_txn", ObjToStore.getDate_txn()); stmt.setString("log_json", ObjToStore.getLog_json()); stmt.setString("status", ObjToStore.getStatus()); stmt.setString("reference_num", ObjToStore.getReference_num()); stmt.setString("tx_type", ObjToStore.getTx_type()); int i = stmt.executeUpdate(); if (i != 1) { throw new RuntimeException("Insert failed"); } } catch (Exception e) { throw new RuntimeException(e); } return getObject(blgDsFactory, ObjToStore.getGuid()); }