Re: [Hibernate-devel] XML SessionFactory configuration
I expressed this badly, of course. I was meaning to imply no hooks into the system initialization procedure as opposed to hooks into the component _instance_ initialization procedure. You want to configure a single session factory thats shared between potentially many instances of several components (whether these components be servlets or enterprise beans). I think its reasonable to try and make that a bit easier for people. P.S. Does anyone here use Avalon. I've been having a look at their stuff lately and kind of like it and I'm wondering about writing an adapter that exposes hibernate as an Avalon component. But I've never used Avalon so I would probably not get it right on my own.. > While I don't necessarily think this is a bad idea, I'm not sure I > quite understand why you say a J2EE app has no control over > initialization. What particular app model(s) did you have in mind here? > WAR's for servlet engines? EJB apps? other server side models? ___ Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate-devel] XML SessionFactory configuration
I think this makes sense, and I definately have a use for it. I've implemented more or less the same thing at the web application level where with a ServletContext Listener that listens for the ServletContextCreated event and creates a SessionFactory and stores it in the application scope. With this in place, I would no longer need this code, and I could share the SessionFactory between the instances of the web application. - Original Message - From: To: <[EMAIL PROTECTED]> Sent: Wednesday, June 12, 2002 9:40 AM Subject: [Hibernate-devel] XML SessionFactory configuration > > I've been thinking about the problem of configuring a SessionFactory for > a J2EE application where application code has no control over the system > initialization procedure. I'm thinking that instead of forcing the > application to do this programmatically, there could be a config file > like: > > > >false >true > ="jta.UserTransaction">java:comp/UserTransaction/ > > > my/first/datasource > > > > > > my/other/datasource > > > > > > What I'm thinking of is that a call to > > Hibernate.configure() > > would look for a resource called hibernate.cfg.xml and use that to > configure and register SessionFactory(s) with JNDI. Subsequent > calls would do nothing. That way application components could all > call Hibernate.configure() when instantiated but we would guarantee > that the factories would only be initialized once. > > I dont want to see an explosion of configuration files but I think > this is reasonable. > > Opinions? Suggestions? > > I will check in some code sometime in the next couple of days for > people to play with > > Gavin. > > > ___ > > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > ___ > Hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > ___ Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
[Hibernate-devel] XML SessionFactory configuration
I've been thinking about the problem of configuring a SessionFactory for a J2EE application where application code has no control over the system initialization procedure. I'm thinking that instead of forcing the application to do this programmatically, there could be a config file like: false true java:comp/UserTransaction/ my/first/datasource my/other/datasource What I'm thinking of is that a call to Hibernate.configure() would look for a resource called hibernate.cfg.xml and use that to configure and register SessionFactory(s) with JNDI. Subsequent calls would do nothing. That way application components could all call Hibernate.configure() when instantiated but we would guarantee that the factories would only be initialized once. I dont want to see an explosion of configuration files but I think this is reasonable. Opinions? Suggestions? I will check in some code sometime in the next couple of days for people to play with Gavin. ___ Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel