package zbi.risk.server.vhi.mapped public class HistoricDA { public List readAll()throws SQLException { Statement statement=null; ResultSet rs=null; Connection connection=null; String strQuery=null; List list=null; try { Historic historic = new Historic(); connection=getConnection(); statement=connection.createStatement(); list=new ArrayList(); strQuery="select trade_date, trade_date_txt, portfolio, sub_portfolio, ticker, ticker_desc, uticker, instrument, mkt_cap, wgt_ave, volume, contract_size, hedge_index, hedge_sector, area, area_sector, [close], y_close, uticker_close, y_uticker_close, delta, y_delta, days_expire, strike_price, hedge_beta, area_beta, sector_beta, group_beta, qty, y_qty, qty_change, hedge_close, hedge_perc, area_close, area_perc, sector_close, sector_perc, mkt_value, y_mkt_value, pnl, exposure, y_exposure, hb_exposure, y_hb_exposure, ab_exposure, y_ab_exposure, sb_exposure, y_sb_exposure, area_pnl_amt, sector_pnl_amt, pnl_perc, price_change, price_change_perc, price_change_amt, sector_alpha_perc, group_alpha_perc, area_alpha_perc, sector_alpha_amt, group_alpha_amt, area_alpha_amt, ab_return_amt, ab_return_perc, intraday_perc, intraday_amt, optionality_amt, optionality_perc, currency, base_close, y_base_close, fx_perc, fx_amt, fx_rate, y_fx_rate, alt_index_return_perc, alt_index_return_amt, index_beta_adj_perc, index_beta_adj_amt, vwap, vwap_pnl, hedge_alpha_amt, exposure_view, market_view, call_put, [month], private, ipo, ratio, source, go_around, adh, aac, azap, exported, hedge_alpha_perc, alpha_go_around, alpha_real, alpha_unreal, pnl_real, pnl_unreal, cash_flow, beta_cash_flow, last_trade_date, last_trade_qty, enterprise_value, associate from dt_main_positions"; rs=statement.executeQuery(strQuery); while(rs.next()) { historic.setTradeDate(rs.getTimestamp("trade_date")); historic.setTradeDateTxt(rs.getString("trade_date_txt")); historic.setPortfolio(rs.getString("portfolio")); historic.setSubPortfolio(rs.getString("sub_portfolio")); historic.setTicker(rs.getString("ticker")); historic.setTickerDesc(rs.getString("ticker_desc")); historic.setUticker(rs.getString("uticker")); historic.setInstrument(rs.getString("instrument")); historic.setMktCap(rs.getFloat("mkt_cap")); historic.setWgtAve(rs.getFloat("wgt_ave")); historic.setVolume(rs.getFloat("volume")); historic.setContractSize(rs.getFloat("contract_size")); historic.setHedgeIndex(rs.getString("hedge_index")); historic.setHedgeSector(rs.getString("hedge_sector")); historic.setArea(rs.getString("area")); historic.setAreaSector(rs.getString("area_sector")); historic.set[close](rs.getFloat("[close]")); historic.setYClose(rs.getFloat("y_close")); historic.setUtickerClose(rs.getFloat("uticker_close")); historic.setYUtickerClose(rs.getFloat("y_uticker_close")); historic.setDelta(rs.getFloat("delta")); historic.setYDelta(rs.getFloat("y_delta")); historic.setDaysExpire(rs.getInt("days_expire")); historic.setStrikePrice(rs.getFloat("strike_price")); historic.setHedgeBeta(rs.getFloat("hedge_beta")); historic.setAreaBeta(rs.getFloat("area_beta")); historic.setSectorBeta(rs.getFloat("sector_beta")); historic.setGroupBeta(rs.getFloat("group_beta")); historic.setQty(rs.getFloat("qty")); historic.setYQty(rs.getFloat("y_qty")); historic.setQtyChange(rs.getFloat("qty_change")); historic.setHedgeClose(rs.getFloat("hedge_close")); historic.setHedgePerc(rs.getFloat("hedge_perc")); historic.setAreaClose(rs.getFloat("area_close")); historic.setAreaPerc(rs.getFloat("area_perc")); historic.setSectorClose(rs.getFloat("sector_close")); historic.setSectorPerc(rs.getFloat("sector_perc")); historic.setMktValue(rs.getFloat("mkt_value")); historic.setYMktValue(rs.getFloat("y_mkt_value")); historic.setPnl(rs.getFloat("pnl")); historic.setExposure(rs.getFloat("exposure")); historic.setYExposure(rs.getFloat("y_exposure")); historic.setHbExposure(rs.getFloat("hb_exposure")); historic.setYHbExposure(rs.getFloat("y_hb_exposure")); historic.setAbExposure(rs.getFloat("ab_exposure")); historic.setYAbExposure(rs.getFloat("y_ab_exposure")); historic.setSbExposure(rs.getFloat("sb_exposure")); historic.setYSbExposure(rs.getFloat("y_sb_exposure")); historic.setAreaPnlAmt(rs.getFloat("area_pnl_amt")); historic.setSectorPnlAmt(rs.getFloat("sector_pnl_amt")); historic.setPnlPerc(rs.getFloat("pnl_perc")); historic.setPriceChange(rs.getFloat("price_change")); historic.setPriceChangePerc(rs.getFloat("price_change_perc")); historic.setPriceChangeAmt(rs.getFloat("price_change_amt")); historic.setSectorAlphaPerc(rs.getFloat("sector_alpha_perc")); historic.setGroupAlphaPerc(rs.getFloat("group_alpha_perc")); historic.setAreaAlphaPerc(rs.getFloat("area_alpha_perc")); historic.setSectorAlphaAmt(rs.getFloat("sector_alpha_amt")); historic.setGroupAlphaAmt(rs.getFloat("group_alpha_amt")); historic.setAreaAlphaAmt(rs.getFloat("area_alpha_amt")); historic.setAbReturnAmt(rs.getFloat("ab_return_amt")); historic.setAbReturnPerc(rs.getFloat("ab_return_perc")); historic.setIntradayPerc(rs.getFloat("intraday_perc")); historic.setIntradayAmt(rs.getFloat("intraday_amt")); historic.setOptionalityAmt(rs.getFloat("optionality_amt")); historic.setOptionalityPerc(rs.getFloat("optionality_perc")); historic.setCurrency(rs.getString("currency")); historic.setBaseClose(rs.getFloat("base_close")); historic.setYBaseClose(rs.getFloat("y_base_close")); historic.setFxPerc(rs.getFloat("fx_perc")); historic.setFxAmt(rs.getFloat("fx_amt")); historic.setFxRate(rs.getFloat("fx_rate")); historic.setYFxRate(rs.getFloat("y_fx_rate")); historic.setAltIndexReturnPerc(rs.getFloat("alt_index_return_perc")); historic.setAltIndexReturnAmt(rs.getFloat("alt_index_return_amt")); historic.setIndexBetaAdjPerc(rs.getFloat("index_beta_adj_perc")); historic.setIndexBetaAdjAmt(rs.getFloat("index_beta_adj_amt")); historic.setVwap(rs.getFloat("vwap")); historic.setVwapPnl(rs.getFloat("vwap_pnl")); historic.setHedgeAlphaAmt(rs.getFloat("hedge_alpha_amt")); historic.setExposureView(rs.getString("exposure_view")); historic.setMarketView(rs.getString("market_view")); historic.setCallPut(rs.getString("call_put")); historic.set[month](rs.getString("[month]")); historic.setPrivate(rs.getBoolean("private")); historic.setIpo(rs.getBoolean("ipo")); historic.setRatio(rs.getFloat("ratio")); historic.setSource(rs.getString("source")); historic.setGoAround(rs.getTimestamp("go_around")); historic.setAdh(rs.getFloat("adh")); historic.setAac(rs.getFloat("aac")); historic.setAzap(rs.getFloat("azap")); historic.setExported(rs.getBoolean("exported")); historic.setHedgeAlphaPerc(rs.getFloat("hedge_alpha_perc")); historic.setAlphaGoAround(rs.getFloat("alpha_go_around")); historic.setAlphaReal(rs.getFloat("alpha_real")); historic.setAlphaUnreal(rs.getFloat("alpha_unreal")); historic.setPnlReal(rs.getFloat("pnl_real")); historic.setPnlUnreal(rs.getFloat("pnl_unreal")); historic.setCashFlow(rs.getFloat("cash_flow")); historic.setBetaCashFlow(rs.getFloat("beta_cash_flow")); historic.setLastTradeDate(rs.getTimestamp("last_trade_date")); historic.setLastTradeQty(rs.getFloat("last_trade_qty")); historic.setEnterpriseValue(rs.getFloat("enterprise_value")); historic.setAssociate(rs.getString("associate")); list.add(historic); } return list; } finally { if(null!=rs)rs.close(); if(null!=statement)statement.close(); } } private Connection getConnection()throws SQLException { try { InitialContext jndiCntx=new InitialContext(); DataSource ds=(DataSource)jndiCntx.lookup("java:DRMS") jndiCntx.close(); return ds.getConnection(); } catch(NamingException exception) { message("[getConnection] Object not found"); throw new EJBException(exception); } } };