maximum « Oracle « JPA Q&A





1. maximum open cursors in oracle    forum.hibernate.org

Hi, I am using Hibernate 2.0.3. I am fetching some records from oracle9i database. And after some time i get an error as maximum open cursors exceeded. Here is the code : Query q = session.createQuery("from UserRoles as userRoles where userRoles._userId = ?"); q.setString(0, userName); Iterator userRolesIter = q.iterate(); while (userRolesIter.hasNext()) { userRoles = (UserRoles) userRolesIter.next(); role = getRole(userRoles.get_roleId(), session); } ...

2. ORA-01000: maximum open cursors exceeded    forum.hibernate.org

See system table to debug leaks, as I remember it is v$open_cursors . See "open" SQL queries and find related code, this error means you have cursor leak (unclosed statement or result set). Workaround can be to configure oracle to close cursors at the end of transaction before you find this leak in code.