|Problem with EclipseLink JPA 1.0 and Glassfish 2.1 [message #533382]
||Thu, 13 May 2010 15:48
| Ruben Viegas
Registered: May 2010
I have been using EclipseLink JPA 1.0 and Glassfish 2.1 for a while now and until recently I had (gladly) no problems. I mainly used EclipseLink for database select/insert/update/delete operations and it worked fine.
Recently, I had to provide some statistical reports in various formats and I decided to use JasperReports which needs a connection to be passed to the Engine in order to build the report (the connection is needed for the sql query that extracts the data to fill the report) and export it to the desired format.
I thought that, since I have the Connection available in the EntityManager I could use that connection and pass it to JasperReports. This much is true, however after a couple of times calling that method, glassfish achieved its maximum used connections!
Glassfish is managing the connections and the EntityManager and so, I believed that I was not required to explicitly close the connection. The fact is that, as soon as I put that statement into the code, glassfish stops achieving the maximum number of used connections.
I am certain that this cannot be the solution to my problem because, for example, I will have problems if I try to call more than one report in JasperReports or to persist some entities into the database.
My question is therefore: how can I get hold of the EntityManager's database connection to pass it to JasperReports, build the report with it and letting Glassfish close the connection and the EntityManager without doing it explicitly and without consuming every connection in the connection pool?
Many thanks in advance!
Powered by FUDForum
. Page generated in 0.02635 seconds