Re: opening multiple databases from same program
Franck Routier <[email protected]> Fri, 09 Jul 2010 18:02:30 +0200
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Organization | Axège sarl |
| Message-ID | <1278691350.8516.10.camel@franck-laptop> |
Hi,
well, AFAIK, you can't do that... !
SSessionJdbc has built-in checks that a connection is single threaded
using a ThreadLocal object. [I think Hibernate has some kind of best
practice to achieve the same goal (I'm not formal here, I didn't use
hibernate for years)]
There is only one dataSource per SSessionJdbc and one SSessionJdbc per
thread.
You could implement a different strategy to handle this part. Some work
was done along this path in a previous version of Simpleorm, for using a
single JTA transaction per session. But it is not maintained.
See simpleorm/extras/SConnectionEJB.java
My question would be : what are you trying to achieve ?
Franck
Le vendredi 09 juillet 2010 à 17:11 +0200, Noel Grandin a écrit :
>
> Hi
>
> I'm opening multiple different databases from the same thread, which
> is triggering this check:
>
> simpleorm.utils.SException$Error: Thread's SSession already open [SS
> 1.SkyMon]
> [0@17:08:40.976] !SE>: at
> simpleorm.sessionjdbc.SSessionJdbc.innerOpen(SSessionJdbc.java:129)
> [0@17:08:40.976] !SE>: at
> simpleorm.sessionjdbc.SSessionJdbc.open(SSessionJdbc.java:88)
> [0@17:08:40.976] !SE>: at
> simpleorm.sessionjdbc.SSessionJdbc.open(SSessionJdbc.java:108)
>
>
> What do I do?
>
> Thanks, Noel Grandin
>
>
>
>
>
>
>
> ______________________________________________________________________
> Disclaimer: http://www.peralex.com/disclaimer.html
>
>
>
>
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/