-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Oracle and Hibernate session problem
PostPosted: Wed Feb 02, 2005 11:04 am 
Newbie

Joined: Mon Jan 10, 2005 12:59 am
Posts: 2
Hi,

I am creating test cases for my application using Hibernate to connect
to an Oracle database. Each test case creates a Hibernate session and
query data from the Oracle database. After 10 test cases are run,
JUnit hangs.

Tried this with 8i, 9i, and 10g. Same result.

Has anyone encountered this kind of problem?


Below is a sample test case. As you may notice session is created and closed for every test case.


Code:
public class ShipLotReturnAuthTest extends TestCase {

   private Session session;

   public void testRetrieve() throws Exception {
      List result = session.find("from s in class ShipLotReturnAuth");
      assertNotNull("result should not be null",result);
      assertEquals(2, result.size());

      for (Iterator iterator = result.iterator(); iterator.hasNext();) {
         ShipLotReturnAuth shipLotReturnAuth =
             (ShipLotReturnAuth) iterator.next();

         assertNotNull("DispositionAgentRANum should not be null",
             shipLotReturnAuth.getDispositionAgenRANum());
         assertNotNull("ShipLot should not be null",
             shipLotReturnAuth.getShipLot());
      }
   }

   protected void setUp() {
      try {
         session = HibernateSession.getOracleSession();
      }
      catch (HibernateException e) {
         logger.info(e.toString());
      }
   }

   protected void tearDown() {
      if (session != null) {
         try {
            session.close();
         }
         catch (HibernateException e) {

         }
      }
   }
}



--
Bernard


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 11:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You are not doing any transaction management, do so.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.