Hi, thank you for the hint!
I changed the hibernate.cfg.xml and the source code accordingly. But I still receive the following exception:
Code:
javax.naming.NameNotFoundException: While trying to look up comp/env/hibernate/HibernateFactory in /app/ejb/EJBHibernateSampleClasses.jar#CustomerListSession.; remaining name 'comp/env/hibernate/HibernateFactory'
at sample.server.util.HibernateUtil.getSession(HibernateUtil.java:102)
I also tried "java:/HibernateFactory" as JNDI name. It did not work either.
Do you have any more hints?
Thanks for your time.
Michael
My hibernate.cfg.xml:
Code:
<hibernate-configuration>
<session-factory name="java:comp/env/hibernate/HibernateFactory">
<property name="connection.datasource">jdbc/HibernateSampleDS</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</property>
<property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="hibernate.jndi.url">t3://192.168.1.1:7011</property>
<property name="hibernate.session_factory_name">java:comp/env/hibernate/HibernateFactory</property>
<property name="show_sql">true</property>
<property name="cache.use_query_cache">false</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="hibernate.query.substitutions">true 1, false 0</property>
<mapping resource="mapping.hbm.xml"/>
</session-factory>
</hibernate-configuration>
My code in HibernateUtil:
Code:
private SessionFactory getSessionFactory() throws NamingException {
InitialContext initCtx = new InitialContext( );
return (SessionFactory) initCtx.lookup("java:comp/env/hibernate/HibernateFactory");
}