humble wrote:
I asked the same question about JNDI under Tomcat. After new InitialContext(), I did a:
Context ctx = new InitialiContext();
SessionFactory sf = (SessionFactory)ctx.lookup("dgf:/made/up/jndiName");
I used my sessionFactory normally after that. I put it into that context by using a hibernate.cfg.xml and in the opening sessionfactory statement doing this:
<session-factory name="dgf:/made/up/jndiName">
Hibernate created that non-existent context for me. I didn't have to specify any web.xml or server resources to hold it. On Tomcat, my one trick was to not use the example "java:comp/env" related name because, in Tomcat, that is read-only and can't be added to by Hibernate or any webapp unless it's there before the servlet started (i.e. in the server configuration's context or as a resource in web.xml).
Regards,
David
Thanks David. I'll try it.