Your code doesn't guarantee that close() gets called, if an exception
occurs during commit()....

However, that is probably not the problem.

You could try disabling Hibernate's PreparedStatement cache (there is
mention of this
in the FAQ) which is quite aggressive by default. Also try disabling
connection pooling.
Some fiddling there should make the open cursors go away.



                                                                                       
                                               
                    Ugo Cei <[EMAIL PROTECTED]>                                        
                                                   
                    Sent by:                                To:     [EMAIL PROTECTED]  
                           
                    [EMAIL PROTECTED]       cc:                                        
                               
                    eforge.net                              Subject:     [Hibernate] 
Cursors still open after session.close()         
                                                                                       
                                               
                                                                                       
                                               
                    21/01/03 10:01 PM                                                  
                                               
                    Please respond to hibernate-devel                                  
                                               
                                                                                       
                                               
                                                                                       
                                               




I'm using Hibernate 1.2.1 in a webapp under JDK 1.4.1, Tomcat 4.1.12,
Oracle 8i and I'm experiencing this phenomenon: cursor are still open
after I close the session. This is a sample servlet code:

try {
   session = sessionFactory.openSession();
   List istituti = session.find
     ("from Istituto in class it.cbim.workflow.model.Istituto"
      + " where Istituto.DirettoreScientifico = ?",
      username, Hibernate.STRING);
   if (istituti.size() > 0) {
     Istituto istituto = (Istituto) istituti.get(0);
     for (Iterator it = istituto.getLineeDiRicerca().iterator() ;
          it.hasNext() ; ) {
       LineaDiRicerca linea = (LineaDiRicerca) it.next();
       // Some code to output
     }
   }
   session.connection().commit();
   session.close();
   session = null;
}
finally {
   if (session != null) {
     session.connection().commit();
     session.close();
   }
}

After executing this code once, I have 5 open cursors in Oracle (one for
the "Istituto" class and the others for the classes related to it).
What's strange is that after executing this code once again, I still
have 5 cursors open (and not 10). I'm using a JDBC connection to Oracle
and not Tomcat's own connection pool via JNDI.

Is this behaviour normal?

           TIA,

                     Ugo

--
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel




**********************************************************************
Any personal or sensitive information contained in this email and
attachments must be handled in accordance with the Victorian Information
Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988
(Commonwealth), as applicable.

This email, including all attachments, is confidential.  If you are not the
intended recipient, you must not disclose, distribute, copy or use the
information contained in this email or attachments.  Any confidentiality or
privilege is not waived or lost because this email has been sent to you in
error.  If you have received it in error, please let us know by reply
email, delete it from your system and destroy any copies.
**********************************************************************





-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to