users@glassfish.java.net

Re: Hibernate + ConnectionPool

From: <glassfish_at_javadesktop.org>
Date: Tue, 24 Aug 2010 12:14:52 PDT

As per hibernate documentation page 47

3.8.2 JNDI-bound SessionFactory:

If you wish to have the SessionFactory bound to a JNDI namespace, specify a name (e.g.
java:hibernate/SessionFactory) using the property hibernate.session_factory_name

When binding the SessionFactory to JNDI, Hibernate will use the values of
hibernate.jndi.url, hibernate.jndi.class to instantiate an initial context. If they are not
specified, the default InitialContext will be used.

Hibernate will automatically place the SessionFactory in JNDI after you call
cfg.buildSessionFactory(). This means you will have this call in some startup code, or utility
class in your application, unless you use JMX deployment with the HibernateService (this is
discussed later in greater detail).

No where does it mention that i have to instantiate InitialContext() in my code, hibernate does all that for me!
[Message sent by forum member 'java_on_fire']

http://forums.java.net/jive/thread.jspa?messageID=480907