From: Gavin K. <Gav...@ex...> - 2003-01-03 02:47:32
|
> The old way I was doing it - now obviously kludgy - was to=20 > create a new session factory everytime I initialized a DAO. =20 That would have been your problem. You *must* make sure that ALL DAOs are using the same Session instance. (And=20 SessionFactory _should_ certainly be a singleton.) ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Matt R. <ma...@ra...> - 2003-01-03 06:03:03
|
I'm using the Thread Local Session as described at http://hibernate.bluemars.net/42.html. To my knowledge, this is a singleton - or do I need to get fancier, as this (http://members.tripod.com/rwald/java/articles/Singleton_in_Java.html) suggests? Thanks, Matt > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...] On > Behalf Of Gavin King > Sent: Thursday, January 02, 2003 7:47 PM > To: Matt Raible; hib...@li... > Subject: RE: [Hibernate] Hibernate Thread Local Session and JUnit > > > > > The old way I was doing it - now obviously kludgy - was to > > create a new session factory everytime I initialized a DAO. > > That would have been your problem. You *must* make sure that > ALL DAOs are using the same Session instance. (And > SessionFactory _should_ certainly be a singleton.) > > > ********** CAUTION - Disclaimer ********** > This message may contain privileged and confidential > information. If you are not the intended recipient of this > message (or responsible for delivery of the message to such > person) you are hereby notified that any use, dissemination, > distribution or reproduction of this message is prohibited. > If you have received this message in error, you should > destroy it and kindly notify the sender by reply e-mail. > Please advise immediately if you or your employer do not > consent to Internet e-mail for messages of this kind. > Opinions, conclusions and other information in this message > that do not relate to the official business of Expert > Information Services Pty Ltd ("The Company") shall be > understood as neither given nor endorsed by it. > > The Company advises that this e-mail and any attached > files should be scanned to detect viruses. The Company > accepts no liability for loss or damage (whether caused > by negligence or not) resulting from the use of any > attached files. > **EIS******** End of Disclaimer ********** > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > |
From: Gavin K. <Gav...@ex...> - 2003-01-03 07:08:07
|
In that implementation the JNDI server maintains the reference to the singleton SessionFactory, and the ThreadLocal holds the reference to the "single-per-transaction" Session. There are, of course, other ways to accomplish this.... > -----Original Message----- > From: Matt Raible [mailto:ma...@ra...]=20 > Sent: Friday, 3 January 2003 5:03 PM > To: hib...@li... > Subject: RE: [Hibernate] Hibernate Thread Local Session and JUnit >=20 >=20 > I'm using the Thread Local Session as described at=20 > http://hibernate.bluemars.net/42.html. To my knowledge, this=20 > is a singleton - or do I need to get fancier, as this > (http://members.tripod.com/rwald/java/articles/Singleton_in_Java.html) > suggests? >=20 > Thanks, >=20 > Matt >=20 > > -----Original Message----- > > From: hib...@li... > > [mailto:hib...@li...] On=20 > > Behalf Of Gavin King > > Sent: Thursday, January 02, 2003 7:47 PM > > To: Matt Raible; hib...@li... > > Subject: RE: [Hibernate] Hibernate Thread Local Session and JUnit > >=20 > >=20 > >=20 > > > The old way I was doing it - now obviously kludgy - was=20 > to create a=20 > > > new session factory everytime I initialized a DAO. > >=20 > > That would have been your problem. You *must* make sure that > > ALL DAOs are using the same Session instance. (And=20 > > SessionFactory _should_ certainly be a singleton.) > >=20 > >=20 > > ********** CAUTION - Disclaimer ********** > > This message may contain privileged and confidential > > information. If you are not the intended recipient of this=20 > > message (or responsible for delivery of the message to such=20 > > person) you are hereby notified that any use, dissemination,=20 > > distribution or reproduction of this message is prohibited.=20 > > If you have received this message in error, you should=20 > > destroy it and kindly notify the sender by reply e-mail.=20 > > Please advise immediately if you or your employer do not=20 > > consent to Internet e-mail for messages of this kind.=20 > > Opinions, conclusions and other information in this message=20 > > that do not relate to the official business of Expert=20 > > Information Services Pty Ltd ("The Company") shall be=20 > > understood as neither given nor endorsed by it. > >=20 > > The Company advises that this e-mail and any attached > > files should be scanned to detect viruses. The Company accepts no=20 > > liability for loss or damage (whether caused by negligence or not)=20 > > resulting from the use of any attached files. > > **EIS******** End of Disclaimer ********** > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > hibernate-devel mailing list hib...@li... > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel >=20 |