Hibernate.orgCommunity Documentation
Hibernate does optionally interact with JNDI on the applications behalf. Generally it does this when the application:
has asked the SessionFactory be bound to JNDI
has specified a DataSource to use by JNDI name
is using JTA transactions and the JtaPlatform needs to do JNDI lookups for TM, UT, etc
All of these JNDI calls route through a single service whose role is
org.hibernate.engine.jndi.spi.JndiService
. The standard JndiService
accepts a number of configuration settings
hibernate.jndi.class
- names the
javax.naming.InitialContext
implementation class to use. See
javax.naming.Context#INITIAL_CONTEXT_FACTORY
hibernate.jndi.url
- names the JNDI InitialContext connection url. See
javax.naming.Context.PROVIDER_URL
Any other settings prefixed with hibernate.jndi.
will be collected
and passed along to the JNDI provider.
The standard JndiService assumes that all JNDI calls are relative to the same InitialContext. If your application uses multiple naming servers for whatever reason, you will need a custom JndiService implementation to handle those details.