我们正在使用Weblogoic9.2.3,而DB是Oracle10.2.0.3。
我们如何使用JNDI访问Hibernate SessionFactory?
最佳答案
我热烈建议阅读文档的3.8. J2EE Application Server integration章。但是,使用Weblogic 9.x和Oracle 10g,您将得到如下结果(部分但经过测试的设置):
...
<property name="hibernate.session_factory_name">hibernate.SessionFactory</property> <!-- JNDI bound Session Factory Name -->
<property name="hibernate.jndi.url">t3://localhost:port</property>
<property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="hibernate.jndi.weblogic.jndi.replicateBindings">false</property> <!-- because SessionFactory is not clusterable -->
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
...