From: Gavin_King/Cirrus%<CI...@ci...> - 2002-06-05 12:22:19
|
The code I just committed to CVS makes the SessionFactory bind itself to JNDI when the user specifies the property hibernate.session_factory_name. This allows BMP EJBs, for example, to obtain their SessionFactory with a JNDI lookup. I have a question about this: the way I've done it, we use the same properties hibernate.jndi.url + hibernate.jndi.class for DatasourceCOnnectionProvider (which looks up a Datasource in JNDI) as for SessionFactory. Is there a strong reason to decouple these? ie. would it be normal to have the Datasource registered with a different JNDI provider from the SessionFactory? I want to make this reasonably flexible without having an explosion of these hibernate.xxxx properties..... |
From: Jon L. <jon...@xe...> - 2002-06-05 14:13:59
|
I think this make sense... Doing it this way means you have everything related with persistenace (Connections and the SessionFactory) all bound to the same JNDI tree. The only example I can think of where you would have a datasource registered with a different JNDI provider is if you lookup a remote data source from an external J2EE container, and I think that is not exactly an everyday occurance. ----- Original Message ----- From: <Gavin_King/Cirrus%CI...@ci...> To: <hib...@li...> Sent: Wednesday, June 05, 2002 2:07 PM Subject: [Hibernate-devel] Hibernate + JNDI > The code I just committed to CVS makes the SessionFactory bind itself to > JNDI when the user specifies the property hibernate.session_factory_name. > This allows BMP EJBs, for example, to obtain their SessionFactory with a > JNDI lookup. I have a question about this: the way I've done it, we use the > same properties hibernate.jndi.url + hibernate.jndi.class for > DatasourceCOnnectionProvider (which looks up a Datasource in JNDI) as for > SessionFactory. Is there a strong reason to decouple these? ie. would it be > normal to have the Datasource registered with a different JNDI provider > from the SessionFactory? > > I want to make this reasonably flexible without having an explosion of > these hibernate.xxxx properties..... > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Hibernate-devel mailing list > Hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > |
From: Viktor S. <phr...@im...> - 2002-06-06 05:24:44
|
hi, Gavin_King/Cirrus%CI...@ci... wrote: >The code I just committed to CVS makes the SessionFactory bind itself to >JNDI when the user specifies the property hibernate.session_factory_name. >This allows BMP EJBs, for example, to obtain their SessionFactory with a >JNDI lookup. I have a question about this: the way I've done it, we use the >same properties hibernate.jndi.url + hibernate.jndi.class for >DatasourceCOnnectionProvider (which looks up a Datasource in JNDI) as for >SessionFactory. Is there a strong reason to decouple these? ie. would it be >normal to have the Datasource registered with a different JNDI provider >from the SessionFactory? > >I want to make this reasonably flexible without having an explosion of >these hibernate.xxxx properties..... > > i'm new to hibernate, i haven't actually used it for much yet, so excuse my ignorance :) Based on what you described, i can't really see how hibernate would work with multiple datasources in a j2ee environment (which i think is really important: the reasons for using J2EE are less, if you dont have to juggle multiple datasources, etc). It seems to me that putting the JNDI binding stuff in hibernate is probably a bad idea, _especially_ using VM level settings. Something like this would be more flexible i think: - configure the SessionFactories you need in one (or more) startup class and bind them in JNDI. take the parameters from wherever you like (eg. in weblogic you can pass params to a startup class) - and just put a resource ref (or env-ref?) in the beans' descriptor pointing to the sessionfactory it's going to use (or more, if you happen to need more in the same bean) of course, nothing prevents me from doing this anyway, i guess :) but in what you described i don't really see the point in having all these jndi features in the hibernate core. what i really like about hibernate so far, is that it tries to do only one thing, and does that in an elegant fashion. i think the jndi stuff is just bloat, that in a simple case you don't need, in a complex case you can't use. best regards, viktor |
From: Viktor S. <phr...@im...> - 2002-06-06 05:26:36
|
hi, Gavin_King/Cirrus%CI...@ci... wrote: >The code I just committed to CVS makes the SessionFactory bind itself to >JNDI when the user specifies the property hibernate.session_factory_name. >This allows BMP EJBs, for example, to obtain their SessionFactory with a >JNDI lookup. I have a question about this: the way I've done it, we use the >same properties hibernate.jndi.url + hibernate.jndi.class for >DatasourceCOnnectionProvider (which looks up a Datasource in JNDI) as for >SessionFactory. Is there a strong reason to decouple these? ie. would it be >normal to have the Datasource registered with a different JNDI provider >from the SessionFactory? > >I want to make this reasonably flexible without having an explosion of >these hibernate.xxxx properties..... > > i'm new to hibernate, i haven't actually used it for much yet, so excuse my ignorance :) Based on what you described, i can't really see how hibernate would work with multiple datasources in a j2ee environment (which i think is really important: the reasons for using J2EE are less, if you dont have to juggle multiple datasources, etc). It seems to me that putting the JNDI binding stuff in hibernate is probably a bad idea, _especially_ using VM level settings. Something like this would be more flexible i think: - configure the SessionFactories you need in one (or more) startup class and bind them in JNDI. take the parameters from wherever you like (eg. in weblogic you can pass params to a startup class) - and just put a resource ref (or env-ref?) in the beans' descriptor pointing to the sessionfactory it's going to use (or more, if you happen to need more in the same bean) of course, nothing prevents me from doing this anyway, i guess :) but in what you described i don't really see the point in having all these jndi features in the hibernate core. what i really like about hibernate so far, is that it tries to do only one thing, and does that in an elegant fashion. i think the jndi stuff is just bloat, that in a simple case you don't need, in a complex case you can't use. best regards, viktor |