1,weblogic的jndi的名字如果是webso,则配置如下:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">webso</property>
<property name="hibernate.connection.provider_class">net.sf.hibernate.connection.DatasourceConnectionProvider</property>
<property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="show_sql">false</property>
<property name="hibernate.jdbc.fetch_size">100</property>
<property name="hibernate.jdbc.batch_size">50</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
2:看看源码就知道了:
public Configuration configure() throws HibernateException {
configure("/hibernate.cfg.xml");
return this;
}
它默认读hibernate.cfg.xml这个文件,它在你的class的根下。
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">webso</property>
<property name="hibernate.connection.provider_class">net.sf.hibernate.connection.DatasourceConnectionProvider</property>
<property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="show_sql">false</property>
<property name="hibernate.jdbc.fetch_size">100</property>
<property name="hibernate.jdbc.batch_size">50</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
2:看看源码就知道了:
public Configuration configure() throws HibernateException {
configure("/hibernate.cfg.xml");
return this;
}
它默认读hibernate.cfg.xml这个文件,它在你的class的根下。
<property name="hibernate.session_factory_name">HibernateSessionFactory</property>是不是意味着hibernate自己给我绑定HibernateSessionFactory这个jndi了,以后进入程序还需要自己bind吗