我看了Configuration的源代码,构造函数里只调用了reset() protected void reset() {
classes = new HashMap();
collections = new HashMap();
tables = new HashMap();
namedQueries = new HashMap();
namedSqlQueries = new HashMap();
secondPasses = new ArrayList();
interceptor = EMPTY_INTERCEPTOR;
properties = Environment.getProperties();
}
是不是最后一行的properties = Environment.getProperties()有问题??
classes = new HashMap();
collections = new HashMap();
tables = new HashMap();
namedQueries = new HashMap();
namedSqlQueries = new HashMap();
secondPasses = new ArrayList();
interceptor = EMPTY_INTERCEPTOR;
properties = Environment.getProperties();
}
是不是最后一行的properties = Environment.getProperties()有问题??
during application initialization. The single instance should then be used by all
code in a particular process, and any Sessions should be created using this single
SessionFactory. A frequently asked question is where this factory must be placed
and how it can be accessed without much hassle.
In a J2EE environment, a SessionFactory bound to JNDI is easily shared between
different threads and between various Hibernate-aware components.上面的文字出自Hibernate in action,但是其中没有提到ejb和hibernate会有冲突?为什么会有冲突呢?
还有每一次建立sessionfatory是非常耗资源得,而建立session耗费资源就来得小的多,所以当你绑定到jndi得时候,效率也会高点.
確實用jndi好像會好一些,關於配置hibernate,我也不是很明白
你看看是不是因爲這個錯誤