// Path: chapter05/src/main/java/com/packt/pfblueprints/model/InvestorsList.java
// public class InvestorsList implements Serializable{
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 	private int id;
// 	private String username;
// 	private String password;
// 	public int getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getUsername() {
// 		return username;
// 	}
// 	public void setUsername(String username) {
// 		this.username = username;
// 	}
// 	public String getPassword() {
// 		return password;
// 	}
// 	public void setPassword(String password) {
// 		this.password = password;
// 	}
// 	
// }


import java.sql.SQLException;
import java.util.List;
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.InvestorsList;

package com.packt.pfblueprints.dao;







public class LoginDAO {

	private  SessionFactory sessionFactory;

	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 LoginDAO() throws SQLException {
		super();

	}

	
	public boolean validateUser(String userid, String password) {
		try {
			sessionFactory = configureSessionFactory();
			Session session = sessionFactory.openSession();
			session.beginTransaction();
			String query = "from InvestorsList  where username='" + userid + "' and password='" + password + "'";
		    Query queryobj = session.createQuery(query);
		    List<InvestorsList> list=queryobj.list();
		    int count=0;

// Path: chapter05/src/main/java/com/packt/pfblueprints/model/InvestorsList.java
// public class InvestorsList implements Serializable{
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 	private int id;
// 	private String username;
// 	private String password;
// 	public int getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getUsername() {
// 		return username;
// 	}
// 	public void setUsername(String username) {
// 		this.username = username;
// 	}
// 	public String getPassword() {
// 		return password;
// 	}
// 	public void setPassword(String password) {
// 		this.password = password;
// 	}
// 	
// }


// Path: chapter05/src/main/java/com/packt/pfblueprints/dao/LoginDAO.java
import java.sql.SQLException;
import java.util.List;
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.InvestorsList;

package com.packt.pfblueprints.dao;







public class LoginDAO {

	private  SessionFactory sessionFactory;

	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 LoginDAO() throws SQLException {
		super();

	}

	
	public boolean validateUser(String userid, String password) {
		try {
			sessionFactory = configureSessionFactory();
			Session session = sessionFactory.openSession();
			session.beginTransaction();
			String query = "from InvestorsList  where username='" + userid + "' and password='" + password + "'";
		    Query queryobj = session.createQuery(query);
		    List<InvestorsList> list=queryobj.list();
		    int count=0;

		    if(list!=null){
