You can get the transaction or connection from entity manager in JPA, and close the statement or connection - if you want access directly to connection or statement - but be sure that, in some cases, witch the query you have submited to database take a long time or cause a 'database blocking proccess' , closing the connection or statement via jdbc, might not result to closing the session in database server, you can test this by runnig a few concurrent application processes that send some bulk update, delete, select requests to database on a same table that has milions of records .