The code has been playing for months.
Hibernatetemplate hibernatetemplate = Gethibernatetemplate ();
Sessionfactory sessionfactory = Hibernatetemplate.getsessionfactory ();
Session session = Sessionfactory.opensession ();
Query query = session.createsqlquery (HQL). addentity (Arguments.class);
list<arguments> list = Query.list ();
if (List.size () >0)
return list;
This section of code is used by hibernate original eco-SQL. Then this method is called several times later. will let the connection pool draw the light connection (own conjecture). ----------------If a great God can answer the question, where is the root?
The solution is to use
Hibernatetemplate.executefind (New Hibernatecallback () {
Public Object doinhibernate (org.hibernate.Session Session)
Throws Hibernateexception, SQLException {
Query query = session.createsqlquery (HQL). addentity (Object.class);
List<object> list =query.list ();
return list;
}
The proxy can be resolved by using an anonymous inner class.
Why is it? Is there a great God to answer it?
Use of native SQL in hibernate+spring+struts causes oping JDBC Connection Connection pool resource extraction problem