pppoole wrote:
To my knowledge, the session was not designed that way and I really think you should rethink your design.  If you go forward with this, I would strongly suggest that you wrap the the hibernate Session and synchronize methods.  Expect to have problems though. 
My advice is rethink your design.
Thanks pppoole.
So i need to either synchronize the code block or to make it single threaded. like this, right ?
 
public void run(){
     try{
          synchronized (session){
               session.save(object);
          }
     }catch(Exception ex){
          ex.printStackTrace();
     }
}
Is there any other way to achieve multiple threading ?
Or any other way to speedup the db inserts?
Thanks