I am working on a new project on some existing code . It uses HibernateTemplate.findByNamedQueryAndNamedParam to invoke a stored procedure in the database .
When I execute the stored procedure on the database , it executes in 2 or 3 seconds . But I execute it via the HibernateTemplate method , it takes anywhere between 2 to 34 minutes .
When I turn showsql on , I see that there are thousands of select statements being triggered . Any pointers on possible reasons for why this could happen .