I *think* I fixed this problem by implementing a Connection Pool in Tomcat and configuring Hibernate with a HibernationSession (using ThreadLocal) and talking to Oracle using that method. Seems to only open one connection now.
Thanks, Matt > I'm getting the following error when using Hibernate as my persistence > layer: > > java.sql.SQLException: ORA-02391: exceeded simultaneous SESSIONS_PER_USER > limit ORA-02063: preceding line from NAS_AC_72 > ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit ORA-02063: > preceding line from NAS_AC_72 > > Could this be caused by Hibernate? I'm hoping not, but I don't know enough > about it to argue with the DBA that Hibernate (and my code) is not the > problem. Here's is a sample class I'm using to connect: > > public class ChangeRequestDAOHibernate extends BaseDAOHibernate implements > ChangeRequestDAO { > private static SessionFactory sessionFactory; > private static Datastore datastore; > private Log log = LogFactory.getLog(ChangeRequestDAOHibernate.class); > > public ChangeRequestDAOHibernate() throws DAOException { > try { > datastore = Hibernate.createDatastore(); > > datastore.storeClass(com.cable.comcast.dmc.itd.cct.persistence.ChangeRequest > .class); > > // build a SessionFactory > sessionFactory = datastore.buildSessionFactory(); > } catch (MappingException e) { > throw new DAOException(e); > } catch (HibernateException e) { > throw new DAOException(e); > } > } > /** > * @see > com.cable.comcast.dmc.itd.cct.persistence.ChangeRequestDAO#getHeadends(MSO) > */ > public List getHeadendsForMSO(MSO mso) throws DAOException { > Session ses = null; > List headendList = null; > > try { > ses = sessionFactory.openSession(); > > List changeRequests = > (List) ses.find("from cr in class > com.cable.comcast.dmc.itd.cct.persistence.ChangeRequest where cr.msoId=?", > mso.getId(), > Hibernate.LONG); > > if ((changeRequests == null) || > (changeRequests.size() == 0)) { > log.warn("No headends found for msoId: " + > mso.getId()); > return new ArrayList(); > } > > // if results are found, look up the headend names > and build a list of headend objects > LookupDAO lookupDAO = new LookupDAOHibernate(); > List headendIds = new ArrayList(); > > // loop though the change requests and build a list > of headends > for (int i=0; i < changeRequests.size(); i++) { > ChangeRequest cr = (ChangeRequest) > changeRequests.get(i); > Headend h = new Headend(); > h.setId(cr.getHeadendId()); > headendIds.add(h); > } > > headendList = lookupDAO.getHeadendNames(headendIds); > > } catch (Exception e) { > try { > ses.connection().rollback(); > } catch (Exception ex) { > e.printStackTrace(); > } > > throw new DAOException(e); > } finally { > try { > ses.close(); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > > return headendList; > > } > > } > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel -- Matt Raible, Raible Designs, Morrison CO US -- Tel: +1 303 979-5340 -- Mob: +1 720 560-8460 -- Fax: +1 508 256-6471 -- Web: http://www.raibledesigns.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel