@Override
	public List<Product> getProducts(String namePattern) {
		Session session = null;
		Transaction trx = null;
		List results = null;

		try {
			session = sessionFactory.openSession();
			trx = session.beginTransaction();
			Criteria cr = session.createCriteria(Product.class);
			cr.add(Restrictions.like("title", namePattern));
			System.out.println("here!");
			results = cr.list();
			System.out.println("----------------------------");
			
			System.out.println("QUERY FOR PRODUCTS LIKE : " + namePattern);
			System.out.println("RESULTS: ");
			
			Iterator it = results.iterator();
			while(it.hasNext()) {
				System.out.println(it.next());
			}
			
			trx.commit();
		} catch(HibernateException e) {
			if(trx != null) {
				try { trx.rollback(); } catch(HibernateException he) {}
			}
		} finally {
			try { if( session != null ) session.close(); } catch( Exception exCl ) {}
		}
		
		return results;
	}