I want to use the connection pool with JPA / TopLink in my web application running on tomcat.Earlier I use jdbc Connection and Statement classes to manage data in the database; to use the connection pool this way I simply declare the resource in context.xml and get this resource in the application:
Context c = new InitialContext();
DataSource source = (DataSource) ((Context)c.lookup("java:comp/env")).lookup("jdbc/MySource");
And now I want to use such a connection pool with JPA. How can i do this?
One more question: in some examples I saw that reosurce is declared in the context of .xml, and then it is declared in web.xml in <Resource-ex>. Why should I declare it in different places or is it the same ad, I mean, is this the equivalent of an ad in the .xml context?
source
share