Some part of what code? What you have posted does not make sense to me. It looks like straight JDBC with a hibernate session thrown in that is not being initialized or used. Unless releaseSession(session) has a null check it will cause a null pointer exception. If you are using hibernate correctly you should not even have code like the snippet you posted.
With all do respect i am still a newbie to hibernate , adding to that my project is integration of springs,struts and hibernate .
My true idea was to close the database connections used while executing,updating,deletions of queries through out my project.
To be specific some class files uses hibernate connections and session and some class files simple jdbc sessions and connection and so i need to deal this incosistent code.
While dealing with this closing the connections, i came acros hibernate sessionrelease and jdbc connectionclose options,so in that context i posted this above query to get claer idea betweeen. how ever a simple connection close would solve my exception was finalised.
Sorry as this info was not posted in firstplace.
code casuing the exception for max open cursor is below, and i am trying to fix this class file to close the connections