They must have broken that somewhere between 6.1 and 8.1 because it works fine for me. Are you sure it is not getting published, or are you looking it up incorrectly?
My cfg.xml:
Code:
<hibernate-configuration>
<session-factory name="hibernate.session-factory.Oracle">
<property name="jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="jndi.url">t3://127.0.0.1:7001</property>
<!-- irrelevant properties deleted -->
</session-factory>
</hibernate-configuration>
I create the Session Factory in the (almost) the same way. Then retrieve it with:
Code:
InitialContext initialContext = new InitialContext();
SessionFactory sf = (SessionFactory) initialContext.lookup("hibernate.session-factory.Oracle");
(Simplified, of course)
Do you see any entries like this in your logs?
Code:
10:01:56,563 INFO SessionFactoryImpl:132 - building session factory
10:01:56,583 INFO NamingHelper:26 - JNDI InitialContext properties:{java.naming.provider.url=t3://127.0.0.1:7001,
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory}
10:01:57,935 INFO SessionFactoryObjectFactory:86 - Factory name: hibernate.session-factory.Oracle
10:01:57,935 INFO NamingHelper:26 - JNDI InitialContext properties:{java.namin.provider.url=t3://127.0.0.1:7001,
java.naming.factory.initial=weblogic.jndi.WLnitialContextFactory}
10:01:57,945 INFO SessionFactoryObjectFactory:91 - Bound factory to JNDI name:hibernate.session-factory.Oracle
10:01:57,945 WARN SessionFactoryObjectFactory:101 - InitialContext did not impement EventContext
Especially the "Bound factory..." message.