I'm using Hibernate is a servlet container, and I have a servlet context listener that configures Hibernate. What I noticed was that I had to put the JNDI datasource location in both the web.xml (for JSTL and servlets to use) and in the hibernate.cfg.xml.

What I did was a bit of a hack... I had the servlet context listener parse the hibernate.cfg.xml, find the datasource name, and then replaced it with what was in web.xml. I could then hand that DOM object to the hibernate configure method, and hibernate would start great.

The problem I hit today was that with this solution, the XML parsing of hibernate.cfg.xml was called from a class outside of the hibernate.jar, so then it couldn't get to the DTD in the jar.

Any other suggestions for workarounds? There are a number of ways to support loading a configuration, but there doesn't seem to be a way to set properties programmatically. Any thoughts?

--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. [EMAIL PROTECTED]



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to