考虑到线程问题,我修改了一下这个方法
public SessionFactory getInstance()
{
if (null == instance)
synchronized (MyHibernateSessionFactory.class)
if (instance == null) { //初始化... }
}
return instance;
萌新看的不是很懂...