I read a lot about DAO and sessions, but don't understand the problem. Now I use something like this: the main DAO (I added some additional checks in the main DAO) and the DAO implementation for the wicket-based web project. In general, this template can be described as follows:
1) using 1 session per 1 thread;
2) never close a session;
3) always make a transaction after the action.
I am testing it using the DDoS utility and this work (100 connections per second). But when I increase the number of connections, I will have many exceptions about closing the session and not starting a transaction. As I understand it, I should use getCurrentSession () instead of openSession (), but when I modified the getSession () method mainly DAO with getCurrentSession (), I did not fix the error :( Then I tried to use c3p0 and bonecp. Powerful tools did not help to me. Perhaps you explain my mistakes :( except for errors in DNA
source
share