/** * Method 'insert' * * @param dto * @return StatusCodePk */ public StatusCodePk insert(StatusCode dto) { getJdbcTemplate() .update( "INSERT INTO " + getTableName() + " ( CODE_NAME, CODE_VALUE, DELETE_IND ) VALUES ( ?, ?, ? )", dto.getCodeName(), dto.getCodeValue(), dto.getDeleteInd()); StatusCodePk pk = new StatusCodePk(); pk.setId(getJdbcTemplate().queryForInt("select last_insert_id()")); return pk; }
/** Updates a single row in the STATUS_CODE table. */ public void update(StatusCodePk pk, StatusCode dto) throws DataBaseJdbcException { getJdbcTemplate() .update( "UPDATE " + getTableName() + " SET ID = ?, CODE_NAME = ?, CODE_VALUE = ?, DELETE_IND = ? WHERE ID = ?", dto.getId(), dto.getCodeName(), dto.getCodeValue(), dto.getDeleteInd(), pk.getId()); }
/** Deletes a single row in the STATUS_CODE table. */ public void delete(StatusCodePk pk) throws DataBaseJdbcException { getJdbcTemplate().update("DELETE FROM " + getTableName() + " WHERE ID = ?", pk.getId()); }
/** Returns the rows from the STATUS_CODE table that matches the specified primary-key value. */ public StatusCode findByPrimaryKey(StatusCodePk pk) throws DataBaseJdbcException { return findByPrimaryKey(pk.getId()); }