/** * Method 'insert' * * @param dto * @return PoPk */ public PoPk insert(Po dto) { SqlUpdate su = new SqlUpdate( dataSource, "INSERT INTO " + getTableName() + " ( ponumber, podate, prsnumber, prsdate, deliverydate, poreferensi, createdby, corpid, wh_code, department_name, supplier_name, currency, prsremarks, role_code,status, status_date,status, status_date_date ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.compile(); su.update( new Object[] { dto.getPonumber(), dto.getPodate(), dto.getPrsnumber(), dto.getPrsdate(), dto.getDeliverydate(), dto.getPoreferensi(), dto.getCreatedby(), dto.getCorpid(), dto.getWhCode(), dto.getDepartmentName(), dto.getSupplierName(), dto.getCurrency(), dto.getPrsremarks(), dto.getRoleCode(), dto.getStatus(), dto.getStatusdate() }); PoPk pk = new PoPk(); pk.setId(jdbcTemplate.queryForInt("select @@IDENTITY")); return pk; }
/** Updates a single row in the po table. */ public void update(PoPk pk, Po dto) throws PoDaoException { SqlUpdate su = new SqlUpdate( dataSource, "UPDATE " + getTableName() + " SET ponumber = ?, podate = ?, prsnumber = ?, prsdate = ?, deliverydate = ?, poreferensi = ?, createdby = ?, corpid = ?, wh_code = ?, department_name = ?, supplier_name = ?, currency = ?, prsremarks = ?, role_code = ?,status, status_date = ?,status, status_date_date = ? WHERE id = ?"); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.VARCHAR)); su.declareParameter(new SqlParameter(java.sql.Types.TIMESTAMP)); su.declareParameter(new SqlParameter(java.sql.Types.BIGINT)); su.compile(); su.update( new Object[] { dto.getPonumber(), dto.getPodate(), dto.getPrsnumber(), dto.getPrsdate(), dto.getDeliverydate(), dto.getPoreferensi(), dto.getCreatedby(), dto.getCorpid(), dto.getWhCode(), dto.getDepartmentName(), dto.getSupplierName(), dto.getCurrency(), dto.getPrsremarks(), dto.getRoleCode(), dto.getStatus(), dto.getStatusdate(), pk.getId() }); }
/** Returns the rows from the po table that matches the specified primary-key value. */ public Po findByPrimaryKey(PoPk pk) throws PoDaoException { return findByPrimaryKey(pk.getId()); }
/** Deletes a single row in the po table. */ @Transactional public void delete(PoPk pk) throws PoDaoException { jdbcTemplate.update("DELETE FROM " + getTableName() + " WHERE id = ?", pk.getId()); }