开发者

How to use ThreadLocal within Hibernate by Spring

Currently we use a session per Operation 开发者_如何学运维(anti-) Pattern with Hibernate/Spring for our Swing client/server application. The application grew and requests got more and more complex, which resulted in bad performance issues. Because of that, we decided to reuse the session for complex requests, which need to perform more requests on the database.

We have been told that the ThreadLocal Session Pattern might be useful to achieve this aim. We read about it, and it seems to perfectly fit, but I also heard, that Spring can handle ThreadLocals by itself. Unfortunately I wasn’t able to confirm this information and didn’t found any helpful information about it yet. Since I am kinda new to this, I might search for the wrong keywords.

Has anyone any experiences concerning this use case and knows in which context I might find more information about it? Or do we have to take care on when to open/close sessions ourselves? Thanks for any help!

Greets, ymene


Maybe this reply on a forum topic on Spring Community site may help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜