Hi. I use Play 2.0.4 with Java and JPA for ORM. I have a "doLogin" method in Application controller. But after 5 calls (with db.default.partitionCount=1, db.default.maxConnectionsPerPartition=5
db.default.minConnectionsPerPartition=5), i have the message "Time out waiting for a free available connection". It seems dans JPA.em() (and the db connection) is not closed after each request, but a new one start on each. What can I do with this code :
@Transactional(readOnly=true)
public static Result doLogin(String name, String psw) {
Result httpResult;
try {
// we delegate JPA operations on a subclass
wrk = new WorkerDb(JPA.em());
User user = wrk.loadUser(name, psw);
if (user != null) {
httpResult = ok("Ok");
} else {
httpResult = badRequest(name + " unknow or bad psw !");
logout()
}
} catch (Exception e) {
httpResult = badRequest("DB problem: " + e.getMessage());
logout();
}
return httpResult;
}
The error message :
[error] o.h.u.JDBCExceptionReporter - Timed out waiting for a free available connection.
Thank's for your help.