Just start the code is like this directly through the JPA connection, just beginning to click on the button to call the stored procedure, no problem, and so many clicks will not respond: Log Report database connection timeout:
Public String execute (entity entity) {
Session Session = (session) THIS.GETJPA (). GetManager (). Getdelegate ();
Sessionfactoryimpl sessionfactory = (Sessionfactoryimpl) session.getsessionfactory ();
Connection conn = null;
String result = null;
try {
conn = Sessionfactory.getconnectionprovider (). getconnection ();
CallableStatement call = Conn.preparecall ("{Call Sp_former_bmp_info_audit (?,?,?,?,?,?,?,?,?,?,?,?)}");
Call.setstring (1, entity.getparam1 ());
Call.setstring (2, entity.getparam2 ());
Call.setstring (3, ENTITY.GETPARAM3 ());
Call.setstring (4, ENTITY.GETPARAM4 ());
Call.setstring (5, ENTITY.GETPARAM5 ());
Call.setstring (6, ENTITY.GETPARAM6 ());
Call.setstring (7, ENTITY.GETPARAM7 ());
Call.setstring (8, ENTITY.GETPARAM8 ());
Call.setstring (9, Entity.getparam9 ());
Call.setstring (ENTITY.GETPARAM10 ());
Call.setstring (one, ENTITY.GETPARAM11 ());
Call.registeroutparameter (Types.varchar);
Call.execute ();
result = call.getstring (12);
system.out.println ("parameter:" +entity.getparam1 () + ";" +ENTITY.GETPARAM2 () + ";" +ENTITY.GETPARAM3 () + ";"
+entity.getparam4 () + ";" +ENTITY.GETPARAM5 () + ";" +ENTITY.GETPARAM6 () + ";"
+entity.getparam7 () + ":" +ENTITY.GETPARAM8 () + ";" +ENTITY.GETPARAM9 () + ";"
     +ENTITY.GETPARAM10 () + ";" +ENTITY.GETPARAM11 ());
system.out.println ("The execution result of the old platform out and deposit process is:" +result);
} catch (SQLException e) {
e.printstacktrace ();
}finally{
   IF (conn! = null) {
try {
conn.close ();
} catch (SQLException e) {
e.printstacktrace ();
}
}
}
return result;
}
--later added judgment: If the connection is empty, then the JDBC connection is re-connected and the connection timeout is not present.
Public String execute (entity entity) {
Session Session = (session) THIS.GETJPA (). GetManager (). Getdelegate ();
Sessionfactoryimpl sessionfactory = (Sessionfactoryimpl) session.getsessionfactory ();
Connection conn = null;
String result = null;
try {
conn = Sessionfactory.getconnectionprovider (). getconnection ();
if (conn = = NULL | | conn.isclosed ()) {
try {
Class.forName (Driverclass);
conn = drivermanager.getconnection (URL, username, password);
} catch (ClassNotFoundException e) {
E.printstacktrace ();
}
}
} catch (SQLException E1) {
E1.printstacktrace ();
}
try {
conn = Sessionfactory.getconnectionprovider (). getconnection ();
CallableStatement call = Conn.preparecall ("{Call Sp_former_bmp_info_audit (?,?,?,?,?,?,?,?,?,?,?,?)}");
Call.setstring (1, entity.getparam1 ());
Call.setstring (2, entity.getparam2 ());
Call.setstring (3, ENTITY.GETPARAM3 ());
Call.setstring (4, ENTITY.GETPARAM4 ());
Call.setstring (5, ENTITY.GETPARAM5 ());
Call.setstring (6, ENTITY.GETPARAM6 ());
Call.setstring (7, ENTITY.GETPARAM7 ());
Call.setstring (8, ENTITY.GETPARAM8 ());
Call.setstring (9, Entity.getparam9 ());
Call.setstring (ENTITY.GETPARAM10 ());
Call.setstring (one, ENTITY.GETPARAM11 ());
Call.registeroutparameter (Types.varchar);
Call.execute ();
result = Call.getstring (12);
System.out.println ("The execution result of the old platform out and deposit process is:" +result);
} catch (SQLException e) {
E.printstacktrace ();
}finally{
IF (conn! = null) {
try {
Conn.close ();
} catch (SQLException e) {
E.printstacktrace ();
}
}
}
return result;
}
Java calls stored procedures, with the number of button clicks, the call stored procedures also increased, there will be a timeout problem