> Hi; > > > > Since everyone is being so nice about this, even though it's not a shale > problem, I figured I'd ask here. > > > > In my hibernate setup, I have a HibernateUtil class with some static > initialization code. That code sets a static final variable with my > SessionFactory. > > > > This is a great way to do it because anything that is called in the class, > by definition the SessionFactory has been initialized and can be used. And > the SessionFactory as a static final, I know it won't be changed by > anything. > > > > But. > > > > I need to pass a different cfg file for test (connect directly) vs tomcat > (connect via JNDI for tomcat pooling). And so I need to set a different > filename. I could make the filename a public static in another class, but > that is not good. > > > > So, any ideas? >
Could you use a registered managed bean to return the config file? In the test environment you could register a different implementation with the same managed bean name. You would have to move the static int code in your utility class into a method that could be invoked from a ViewController. Or, even make the utility class a managed bean that uses setter injection to chain together the config file. The managed bean stuff in JSF seems like a perfect fit for managing objects in a declarative fashion between environments. Gary > > > Thanks - dave > > >