Well, since the Hibernate.configure() is probably just using the same thing, then mapping it into JNDI, I mind as well just save it myself and save myself the complexity of switching implementations and doing the JNDI lookup.
> -----Original Message----- > From: Joseph Fifield [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 05, 2003 2:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [Hibernate] Hibernate.cfg.xml without JNDI > > > Since it's threadsafe, it shouldn't be a problem. I obtain > the reference and cache it as a static member inside a > ServiceLocator. That way it's easy to switch between JNDI and > manual configuration. You could probably even have the > ServiceLocator switch automatically, depending on if you're > running tests or not. > > Joe > > > -----Original Message----- > > From: Jason Carreira [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, February 05, 2003 1:41 PM > > To: Joseph Fifield; [EMAIL PROTECTED] > > Subject: RE: [Hibernate] Hibernate.cfg.xml without JNDI > > > > > > Hi Joseph, > > > > Thank you very much! This works great! We're using a static > > member var to hold the SessionFactory that is initialized in > > a static block. Is this a common pattern for saving the > > SessionFactory? > > > > Thanks again, > > > > Jason > > > > > -----Original Message----- > > > From: Joseph Fifield [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, February 05, 2003 12:21 PM > > > To: [EMAIL PROTECTED] > > > Subject: RE: [Hibernate] Hibernate.cfg.xml without JNDI > > > > > > > > > Yes, it is possible. Something like this should do the trick: > > > > > > factory = new Configuration("/hibernate.cfg.xml").configure()[0]; > > > > > > Joe > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] > > > > [mailto:[EMAIL PROTECTED] On > Behalf Of > > > > Jason Carreira > > > > Sent: Wednesday, February 05, 2003 12:13 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: [Hibernate] Hibernate.cfg.xml without JNDI > > > > > > > > > > > > Is it possible to use hibernate.cfg.xml without JNDI? It > > would even > > > > be enough if Hibernate.configure() would return the > > SessionFactory > > > > in addition to binding it to the JNDI context, or make it > > optional. > > > > > > > > The reason is, I'm trying to implement Junit tests that > > only depend > > > > upon getting a database connection, without a container (=JNDI > > > > provider) running. I tried using Mock objects, but their > > MockContext > > > > doesn't seem to actually store the bound objects for > > lookup later. I > > > > don't really want to have to implement my own in-memory > > Context, so > > > > I'm wondering why this form of configuration, by far the > > easiest, is > > > > so limited in what it can do? > > > > > > > > Thanks, > > > > > > > > Jason Carreira > > > > > > > > -- > > > > Jason Carreira > > > > Software Architect, Notiva Corp. > > > > phone: 585.240.2793 > > > > fax: 585.272.8118 > > > > email: [EMAIL PROTECTED] > > > > --- > > > > Notiva - optimizing trade relationships (tm) > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.NET email is sponsored by: > > > > SourceForge Enterprise Edition + IBM + LinuxWorld > > =omething 2 See! > > > > http://www.vasoftware.com > > > > _______________________________________________ > > > > hibernate-devel mailing list > [EMAIL PROTECTED] > > > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.NET email is sponsored by: > > > SourceForge Enterprise Edition + IBM + LinuxWorld = > Something 2 See! > > > http://www.vasoftware.com > > > _______________________________________________ > > > hibernate-devel mailing list [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > > > > > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something > 2 See! http://www.vasoftware.com > _______________________________________________ > hibernate-devel mailing list [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel