哈哈,这个问题我刚开始也遇到过,楼主看的是hibernate reference吧:)
解决的办法很简单,你必须要在HibernateUtil加入你的连接池connection,具体代码如下:/*
 * Created on 2005-4-11
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.jerry.hibernate.util;import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;import com.jerry.hibernate.login.UserModel;
import com.jerry.test.model.db.*;import java.sql.Connection;
/**
 * @author ´óµØ(Jerry Chou)
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class HibernateUtil {

private static final SessionFactory sessionFactory;
// private static final Connection conn;

static{
try{
// conn=MsDbBean.getConnection();
sessionFactory=new Configuration().configure().addClass(UserModel.class).buildSessionFactory();
}catch(HibernateException ex){
throw new RuntimeException("HibernateException building sessionFactory: "+ex.getMessage(),ex);
}
}

public static final ThreadLocal session=new ThreadLocal();

public static Session currentSession() throws HibernateException{
MsDbBean msBean=new MsDbBean();
Connection conn=msBean.getConnection();
Session s=(Session)session.get();
if(s==null){
s=sessionFactory.openSession(conn);
session.set(s);
}
return s;
}

public static void closeSession() throws HibernateException{

Session s=(Session)session.get();
session.set(null);
if(s!=null)
s.close();
}}