// Path: chapter05/src/main/java/com/packt/pfblueprints/model/InvestmentSummary.java
// public class InvestmentSummary implements Serializable{
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 	private int id;
// 	private String accountNumber;
// 	private String fundname;
// 	private String investmentNumber;
// 	private String investmentManager;
// 	private String marketingCompany;
// 	private String avgUnitPrice;
// 	private Double marketValue1;
// 	private Double marketValue2;
// 	private Double marketValue3;
// 	private Double marketValue4;
// 	private Double marketValue5;
// 	public int getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	
// 	public String getAccountNumber() {
// 		return accountNumber;
// 	}
// 	public void setAccountNumber(String accountNumber) {
// 		this.accountNumber = accountNumber;
// 	}
// 	public String getFundname() {
// 		return fundname;
// 	}
// 	public void setFundname(String fundname) {
// 		this.fundname = fundname;
// 	}
// 	
// 	public String getInvestmentNumber() {
// 		return investmentNumber;
// 	}
// 	public void setInvestmentNumber(String investmentNumber) {
// 		this.investmentNumber = investmentNumber;
// 	}
// 	public String getInvestmentManager() {
// 		return investmentManager;
// 	}
// 	public void setInvestmentManager(String investmentManager) {
// 		this.investmentManager = investmentManager;
// 	}
// 	public String getMarketingCompany() {
// 		return marketingCompany;
// 	}
// 	public void setMarketingCompany(String marketingCompany) {
// 		this.marketingCompany = marketingCompany;
// 	}
// 	public String getAvgUnitPrice() {
// 		return avgUnitPrice;
// 	}
// 	public void setAvgUnitPrice(String avgUnitPrice) {
// 		this.avgUnitPrice = avgUnitPrice;
// 	}
// 	public Double getMarketValue1() {
// 		return marketValue1;
// 	}
// 	public void setMarketValue1(Double marketValue1) {
// 		this.marketValue1 = marketValue1;
// 	}
// 	public Double getMarketValue2() {
// 		return marketValue2;
// 	}
// 	public void setMarketValue2(Double marketValue2) {
// 		this.marketValue2 = marketValue2;
// 	}
// 	public Double getMarketValue3() {
// 		return marketValue3;
// 	}
// 	public void setMarketValue3(Double marketValue3) {
// 		this.marketValue3 = marketValue3;
// 	}
// 	public Double getMarketValue4() {
// 		return marketValue4;
// 	}
// 	public void setMarketValue4(Double marketValue4) {
// 		this.marketValue4 = marketValue4;
// 	}
// 	public Double getMarketValue5() {
// 		return marketValue5;
// 	}
// 	public void setMarketValue5(Double marketValue5) {
// 		this.marketValue5 = marketValue5;
// 	}
// 	
// }


import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import com.packt.pfblueprints.model.InvestmentSummary;

package com.packt.pfblueprints.dao;






public class InvestmentSummaryDAO {

	private  SessionFactory sessionFactory;
	private  String accountNumber;

	private  SessionFactory configureSessionFactory()
			throws HibernateException {
		Configuration configuration = new Configuration();
		configuration.configure();
		StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
				.applySettings(configuration.getProperties());
		SessionFactory sessionfactory = configuration
				.buildSessionFactory(builder.build());
		return sessionfactory;
	}

    
	public InvestmentSummaryDAO() {
		super();
		
		ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
		Map<String, Object> sessionMap = externalContext.getSessionMap();
		accountNumber=(String) sessionMap.get("accountNumber");
		// TODO Auto-generated constructor stub
	}



// Path: chapter05/src/main/java/com/packt/pfblueprints/model/InvestmentSummary.java
// public class InvestmentSummary implements Serializable{
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 	private int id;
// 	private String accountNumber;
// 	private String fundname;
// 	private String investmentNumber;
// 	private String investmentManager;
// 	private String marketingCompany;
// 	private String avgUnitPrice;
// 	private Double marketValue1;
// 	private Double marketValue2;
// 	private Double marketValue3;
// 	private Double marketValue4;
// 	private Double marketValue5;
// 	public int getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	
// 	public String getAccountNumber() {
// 		return accountNumber;
// 	}
// 	public void setAccountNumber(String accountNumber) {
// 		this.accountNumber = accountNumber;
// 	}
// 	public String getFundname() {
// 		return fundname;
// 	}
// 	public void setFundname(String fundname) {
// 		this.fundname = fundname;
// 	}
// 	
// 	public String getInvestmentNumber() {
// 		return investmentNumber;
// 	}
// 	public void setInvestmentNumber(String investmentNumber) {
// 		this.investmentNumber = investmentNumber;
// 	}
// 	public String getInvestmentManager() {
// 		return investmentManager;
// 	}
// 	public void setInvestmentManager(String investmentManager) {
// 		this.investmentManager = investmentManager;
// 	}
// 	public String getMarketingCompany() {
// 		return marketingCompany;
// 	}
// 	public void setMarketingCompany(String marketingCompany) {
// 		this.marketingCompany = marketingCompany;
// 	}
// 	public String getAvgUnitPrice() {
// 		return avgUnitPrice;
// 	}
// 	public void setAvgUnitPrice(String avgUnitPrice) {
// 		this.avgUnitPrice = avgUnitPrice;
// 	}
// 	public Double getMarketValue1() {
// 		return marketValue1;
// 	}
// 	public void setMarketValue1(Double marketValue1) {
// 		this.marketValue1 = marketValue1;
// 	}
// 	public Double getMarketValue2() {
// 		return marketValue2;
// 	}
// 	public void setMarketValue2(Double marketValue2) {
// 		this.marketValue2 = marketValue2;
// 	}
// 	public Double getMarketValue3() {
// 		return marketValue3;
// 	}
// 	public void setMarketValue3(Double marketValue3) {
// 		this.marketValue3 = marketValue3;
// 	}
// 	public Double getMarketValue4() {
// 		return marketValue4;
// 	}
// 	public void setMarketValue4(Double marketValue4) {
// 		this.marketValue4 = marketValue4;
// 	}
// 	public Double getMarketValue5() {
// 		return marketValue5;
// 	}
// 	public void setMarketValue5(Double marketValue5) {
// 		this.marketValue5 = marketValue5;
// 	}
// 	
// }


// Path: chapter05/src/main/java/com/packt/pfblueprints/dao/InvestmentSummaryDAO.java
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import com.packt.pfblueprints.model.InvestmentSummary;

package com.packt.pfblueprints.dao;






public class InvestmentSummaryDAO {

	private  SessionFactory sessionFactory;
	private  String accountNumber;

	private  SessionFactory configureSessionFactory()
			throws HibernateException {
		Configuration configuration = new Configuration();
		configuration.configure();
		StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
				.applySettings(configuration.getProperties());
		SessionFactory sessionfactory = configuration
				.buildSessionFactory(builder.build());
		return sessionfactory;
	}

    
	public InvestmentSummaryDAO() {
		super();
		
		ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
		Map<String, Object> sessionMap = externalContext.getSessionMap();
		accountNumber=(String) sessionMap.get("accountNumber");
		// TODO Auto-generated constructor stub
	}



	public List<InvestmentSummary> getAllInvestments() {
