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