www.pudn.com > dangdang.zip > TestProductDAO.java, change:2006-06-22,size:742b


package com.tarena.dangdang.test; 
 
import java.util.List; 
 
import org.hibernate.Session; 
import org.hibernate.Transaction; 
 
import com.tarena.dangdang.dao.ProductDAO; 
import com.tarena.dangdang.dao.impl.ProductDAOImpl; 
import com.tarena.dangdang.entity.Product; 
import com.tarena.dangdang.util.HibernateUtil; 
 
 
public class TestProductDAO { 
  public static void main(String args[]){ 
	  ProductDAO productDAO = new ProductDAOImpl(); 
	   
	  Session session = HibernateUtil.getCurrentSession(); 
	  Transaction tx = session.beginTransaction(); 
	   
	  List<Product> products = productDAO.queryNewProducts(); 
	  for(Product p :products){ 
		  System.out.println(p.getProductDate()); 
	  } 
	   
	  tx.commit(); 
  } 
   
  
}